TotalList ( theList )
Add together all numbers in a text string
Average rating: 4.5 (25 votes) Log in to vote
Geoff Wells DataIsland Software LLC http://www.dataisland.com |
286 471
757 1228
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This function will total all the numbers contained within a text string and separated by a space or carriage return. Letters and punctuation are ignored. Input can be a text field or a function (such as Fibonacci) that outputs a list of numbers.
Comments
Andy Frazier, Mx4Px Nov 18, 2009 |
||
This is a great function - used in conjunction with FoundList(), it eliminates the need for Summary fields if you just need the total of a found set of numbers. However, by using the Word functions, it's dependent on FM's word separators...which, unfortunately in this case, includes the period. That means it will not correctly interpret numbers between 0 and 1 (.19 will be treated as 19, for example). If you use Value functions, it corrects this problem. I realize that breaks the intent of being able to add up space-separated numbers, but thought it might be helpful to know: Let ( Total = 0 ; If ( ValueCount ( theList) > 1; Total + GetAsNumber ( ( LeftValues ( theList; 1 ) ) ) + TotalList ( RightValues ( theList; ValueCount( theList ) - 1) ); Total + GetAsNumber ( ( LeftValues ( theList; 1 ) ) ) ) ) |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.