Defines a function of multiple domains - is also a general Case statement.
Use this where you would normally use a Case statement. The input "cases" is a array of records. Each record has two fields, each of type Text and each one defining a formula to be evaluated. The "if" field of the first record (case) is evaluated. If True then the "eval" field is evaluated and the result is returned. If False then the next record (case) is evaluated the same way. As soon as any condition is matched the function exits. If no condition matches then the original value is returned.
menu: veeos ==> Math ==> ifThenEval
library: mathLib
Define a function of two domains: A>0 and A<5
and A>5 and two accompanying formulas
1/A and 2*A .
For the ifThenEval we then create a record array with two fields such that
rec[0].if = "A>0 and A<5";
rec[0].eval="1/A";
rec[1].if = "A>5";
rec[1].eval = "2*A";
Feeding values A 0,1,2,3,4,5,6,7 to o_ifTheneval(rec,A) we obtain an output of 0,1,1/2,1/3,1/4,5,16,14
VEE never had a Case statement but has always needed one. Originally there was a good reason that Case was not included but, although that reason went away many years ago, Case was never added. This function was developed to fill that gap.
Use eval() extensively
VEE 7.0+, all platforms