Jump to content
Server Maintenance This Week. ×

Calculate Total of right values in list


This topic is 1670 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

Edited by alanf
Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

This topic is 1670 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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