Brian Dunning's FileMaker Custom Functions

TotalList ( valueList )

Get the total of all number values of a given list

  Average rating: 4.4 (30 votes) Log in to vote

SL   SL
ITC

Share on Facebook Share on Twitter

  Sample input:
TotalList ("1¶.22¶.11¶xyz")
  Sample output:
1.33

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

All the credits to Mr Geoff Wells (http://www.dataisland.com) who had written the original one.
Because the use of LeftWords() and RightWords() Geoff's CF was not able to properly add any numbers less than 1 to the total.
For example: TotalList (".11¶.22¶1") returned as result 34 instead of 1.33
Now TotalList (".11¶.22¶1") returns 1.33
Why the old CF was wrong?
LeftWords() and Rightwords() use not-alphanumeric chars as word's separators so:
LeftWords(".11¶.22¶1" ; 1) returns "11".
LeftValues(".11¶.22¶1" ; 1) instead returns .11

 

Comments

Rob Westergaard   Rob Westergaard, Davis, CA
Feb 8, 2010
Is there a situation where the following non-recursive function wouldn't accomplish the same task?

Evaluate ( "Sum ( GetAsNumber ( \"" & Substitute ( valueList ; "¶" ; "\" ) ; GetAsNumber ( \"" ) & "\" ) )" )
 
rivet   rivet, TO
Mar 18, 2011
Does not handle negative numbers
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: