September 29, 20196 yr 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
September 29, 20196 yr 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.
September 29, 20196 yr Author Thanks and sorry guess i need to adjust my profile. Im using 18 pro advanced. Do have custom functions Edited September 29, 20196 yr by alanf
September 29, 20196 yr Also is the list always three items long? As you could use rightwords within a getvalue for each line.
September 29, 20196 yr 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 September 29, 20196 yr by comment
Create an account or sign in to comment