Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Calculate Total of right values in list

Featured Replies

I have a list such as:

(B) KARR SECURITY [PS] $100
(B) PPM Gross [$1270 * 5%] = $63.5
(B) Warranty $50

 

Looking for suggestion and help to grab the last word in each line and calculate the total of the list.  

IE: $100 + $63.5 + $50 

return result $213.50

 

Thanks

 

Your profile shows version 17 (not Advanced). That rules out using a custom function (unless someone installs it for you) as well as the While() function. So you need to script this (unless you know in advance how many lines can there be at most).

My suggestion would be to parse this list to records and fields. Then calculating the total becomes trivial. Note that no matter what method you choose, you must remove the currency symbols before trying to add the values: the result of  $100 + $63.5 + $50 is an empty string.

 

  • Author

Thanks and sorry guess i need to adjust my profile.  Im using 18 pro advanced.  Do have custom functions

Edited by alanf

Also is the list always three items long? As you could use rightwords within a getvalue for each line. 

  • Author

Aussie, no it can be varying in length

25 minutes ago, alanf said:

Im using 18 pro advanced. 

Then you can do =

While ( 
[ 
lines = YourTable::YourField ; 
n = ValueCount ( lines ) ; 
i = 1 ; 
result = "" 
] ;
i ≤ n ;
[ 
line = GetValue ( lines ; i ) ;
lastWord = RightWords ( line ; 1 ) ;
result = result + GetAsNumber ( lastWord ) ;
i = i + 1
] ; 
result
)

 

Still, I wonder if it wouldn't be better to use records and fields. Filemaker is best at handling properly structured data.

Edited by comment

  • Author

Comment,

 

Beautiful.  Thanks for your help!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.