alanf Posted September 29, 2019 Posted September 29, 2019 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
comment Posted September 29, 2019 Posted September 29, 2019 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.
alanf Posted September 29, 2019 Author Posted September 29, 2019 (edited) Thanks and sorry guess i need to adjust my profile. Im using 18 pro advanced. Do have custom functions Edited September 29, 2019 by alanf
Aussie John Posted September 29, 2019 Posted September 29, 2019 Also is the list always three items long? As you could use rightwords within a getvalue for each line.
alanf Posted September 29, 2019 Author Posted September 29, 2019 Aussie, no it can be varying in length
comment Posted September 29, 2019 Posted September 29, 2019 (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 September 29, 2019 by comment 1
alanf Posted September 29, 2019 Author Posted September 29, 2019 Comment, Beautiful. Thanks for your help!
Recommended Posts
This topic is 2216 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 accountSign in
Already have an account? Sign in here.
Sign In Now