Brian Dunning's FileMaker Custom Functions

ValueArithmetic ( List1 ; List2 ; operation )

Does basic arithmetic between two value lists, doing one operation (add, subtract, multiply, divide, raise) at a time

  Average rating: 5.0 (1 vote) Log in to vote

Bill Thurmes   Bill Thurmes - Show more from this author
MDCA
http://www.miyotadca.com

Share on Facebook Share on Twitter

  Sample input:
ValueArithmetic ("2¶3¶4¶5";"3¶2¶2¶2";"^")
  Sample output:
8¶9¶16¶25

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

Will take two value lists and perform an arithmetic operation between the nth value of each. For example, when the operation is addition, the first values of each list will be added together to give the first value of the resultant list. Five types of operations are accepted, and each is denoted by a bit of text: "+", "-", "*", "/", "^". Some other names for the operations are accepted.
The two value lists should have the same number of values. Two exceptions:
If one 'list' has only a single value, this function will work like Extend, so all values of the other list will be treated by the operation with the single value
If one list has more (2+) values than the other, the longer list will be trimmed to the same number of values as the other (so make sure you enter the values correctly!).

An empty value will be treated as a 0.
A divide by zero error will give a '?' for that value in the resultant list

Note that operations are MUCH faster when things are all done in memory (such as is done here, between two lists) than when done in fields, where read/write operations slow everything down

 

Comments

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:

Under construction. Email me your wish list for improvements.