Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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

 

Posted

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.

 

Posted (edited)

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

Edited by alanf
Posted

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

Posted

Aussie, no it can be varying in length

Posted (edited)
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
Posted

Comment,

 

Beautiful.  Thanks for your help!

This topic is 1893 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.