There are many places in PYXI where you can include Calculations. These can be as simple or as sophisticated as you need.
Calculations are used in Calculated Fields, Templates and in various other places in your configuration, in particular being used to control various behaviour of Record Types such as the Display Name, display Icon, and record edit and delete permissions.
Calculations are evaluated in the context of a particular record. This depends on the circumstances in which the calculation is used.
The simplest form of Calculation is the name of a single field of the current record. More sophisticated calculations can use Functions – each argument to a function is itself a Calculation. Functions can, of course, be nested to any required level, although if an individual calculation contains lots of nesting, this is usually a good indication that you should consider breaking the logic down into separate Calculated Fields, or calculate and store some of the values in fields using Automations.
As a Developer user, you will find a Playpen option at the bottom-left of every record page.
This Playpen provides you with a facility to test Calculations – these are evaluated against the record ‘on the fly’ and the result shown to you.
If you need help on a particular function, type its name and the opening parenthesis – the error message will now show that this function is incomplete, but if you hover over the function name, you will see a pop-up window with the complete help description for the function, including details of its parameters.
Calculations can be made up from any of the following:
As well as using any of the above elements on their own, or as parameters to a Function, you can also use all the basic mathematical operators that you would expect.
Generally, this evaluates true if both operands (the values either side of the operator) are the same. However,
there ar a number of special cases where the operands are of certain types, as follows:
|!= or <>||not equals||The logical inverse of equals discussed above|
|>||greater than||Applicable only when both operands are the same type e.g. numeric, date or text|
|>=||greater than or equal to||Applicable only when both operands are the same type e.g. numeric, date or text|
|<||less than||Applicable only when both operands are the same type e.g. numeric, date or text|
|<=||less than or equal to||Applicable only when both operands are the same type e.g. numeric, date or text|
|+||plus / concatenate||The results from this operator depend on the types of operand, as follows:
|–||minus||The results from this operator depend on the types of operand, as follows:
|*||multiply||If both operands are numeric, the result is one multiplied by the other, otherwise zero|
|/||divide||If both operands are numeric, the result is one divided by the other, otherwise zero. Note that if the divisor is zero, the function gracefully returns a result of zero rather than an error.|
|^||power||If both operands are numeric, the result is the first operand raised to the power of the second operand (base 10)|
|!||not||Logical not – returns the logical inverse of the operand following.|