|
|
Calculated fields get their value by following a 'formula' that allows adding, subtracting, multiplying, and dividing the value of other fields, and constants.
To create a 'Calc' field, add a field to the form and double click the field to bring up it's properties window
Select Field Type 'Calculated' from the drop-down box.
After defining a field as 'Calculated', the box for it's formula becomes active, and you must then define how the field will be calculated. The equation for a Calc field is evaluated from left to right. Parentheses and spaces are not allowed, so it's a lot like working an adding machine. Each and every operand (field or constant in the equation) must be preceded by a mathmatical operator ('+','-','*','/'), including the first field or constant. Functions supported are Absolute Value 'abs', Square Root 'sqrt', and power '^'
As an example, here is an equation to add the value of 3 fields, and divide by 3 (giving the average). Assume the field names are 'Fld1', 'Fld2', and 'Fld3' +(Fld1+Fld2+Fld3)/3 The value starts at 0, and adds Fld1, Fld2, and Fld3, then divides that result by 3.
Here is an example using the Square Root function. The calculation will find the square root of a field named 'SqMe' Note that the 'sqrt' function must be in lower case.
Here is an example using the Absolute Value function. The calculation will find the difference between two fields 'FldA' and 'FldB' Note that the 'abs' function must be in lower case.
Here is an example using the Power function. The calculation will raise one field 'Nmbr' by the value of another field 'Powr'
A Calc field is evaluated and displayed when the user taps on it, or when an action button is pressed. If desired, a 'no action' button (labeled 'Recalculate', or something similar) can be added to a form for the user to press. Calc fields can be displayed in tables, but cannot be used as a 'Key' field. 'Calculated Date' and 'Calculated Time' display the result as a date or time. A 'Calculated' field will display the result in days or minutes (if dates or time fields are used in the calculation Checkboxes and Radio buttons can be used in a calculated field, and evaluate as '1' when selected, and '0' when unselected.
|