subtractMinutes
Signature |
{subtractMinutes(format; timestamp; amount)} |
Parameters |
format: format text |
timestamp: date/time value |
|
amount: decimal number |
|
Description |
Subtracts amount minutes from timestamp |
Returns |
Decremented date in format |
Example call |
{subtractMinutes(Ymd H:i:s; 2016-04-22 12:37; 5)} returns 20160422 12:32:00 |
subtractSeconds
Signature |
{subtractSeconds(format; timestamp; amount)} |
Parameters |
format: format text |
timestamp: date/time value |
amount: decimal number |
Description |
Subtracts amount minutes from timestamp |
Returns |
Decremented date in format |
Example call |
{subtractSeconds(Ymd H:i:s; 2016-04-22 12:37; 5)} returns 20160422 12:36:55 |
Control Functions
There is only one control function implemented in Calculate Fields so far, but this function ensures that the user can write very complex formulas with conditions. Since the functions can be embedded in each other, the user can write junctions with many branches.
ifThenElse
Signature |
{ifThenElse(condition; trueBranch; falseBranch)} |
Parameters |
condition: logical value |
trueBranch: any expression |
|
falseBranch: any expression |
|
Description |
Selects one of the two branches depending on condition |
Returns |
trueBranch if condition is true, falseBranch otherwise |
Example call |
{ifThenElse(\{equal(1; 1)}; 1 equals 1; 1 not equals 1)} returns 1 equals 1 |
Counters
There are several counters implemented in Calculate Fields which can be used in various scenarios.
The counters sorted into two groups:
- Global counters: Counters which are incremented every time an affected formula is evaluated
- Daily counters: Counters which resets every day. (Starting from 1)
In this chapter we assume that the counters current value is 4, so the incremented value will be 5 with the given format.
GlobalCounter
Signature |
{GlobalCounter(name; numberLength)} |
Parameters |
name: any text |
numberLength: decimal number |
|
Description |
Increments and returns the counter for name with length numberLength |
Returns |
Counter with length numberLength |
Example call |
{GlobalCounter(myName; 4)} returns 0005 |
GlobalCounterPerUser
Signature |
{GlobalCounterPerUser(name; numberLength)} |
Parameters |
name: any text |
numberLength: decimal number |
|
Description |
Increments and returns the counter for name for the user who creates the entity with length numberLength |
Returns |
Counter with length numberLength |
Example call |
{GlobalCounterPerUser(myName; 3)} returns 005 |
GlobalCounterPerModule
Signature |
{GlobalCounterPerModule(name; numberLength)} |
Parameters |
name: any text |
numberLength: decimal number |
|
Description |
Increments and returns the counter for name for the module of the entity with length numberLength |
Returns |
Counter with length numberLength |
Example call |
{GlobalCounterPerModule(myName; 2)} returns 05 |
GlobalCounterPerUserPerModule
Signature |
{GlobalCounterPerUserPerModule(name; numberLength)} |
Parameters |
name: any text |
numberLength: decimal number |
|
Description |
Increments and returns the counter for name for the user who creates the entity and for the module of the entity with length numberLength |
Returns |
Counter with length numberLength |
Example call |
{GlobalCounterPerUserPerModule(myName; 1)} returns 5 |
DailyCounter
Signature |
{DailyCounter(name; numberLength)} |
Parameters |
name: any text |
numberLength: decimal number |
|
Description |
Increments and returns the counter for name with length numberLength |
Returns |
Counter with length numberLength, or if the counter is not incremented this day then 1 with length numberLength |
Example call |
{DailyCounter(myName; 1)} returns 5 |
DailyCounterPerUser
Signature |
{DailyCounterPerUser(name; numberLength)} |
Parameters |
name: any text |
numberLength: decimal number |
Description |
Increments and returns the counter for name for the user who creates the entity with length numberLength |
Returns |
Counter with length numberLength, or if the counter is not incremented this day for this user then 1 with length numberLength |
Example call |
DailyCounterPerModule
Signature |
{DailyCounterPerModule(name; numberLength)} |
Parameters |
name: any text |
numberLength: decimal number |
|
Description |
Increments and returns the counter for name for the module of the entity with length numberLength |
Returns |
Counter with length numberLength, or if the counter is not incremented this day for this module then 1 with length numberLength |
Example call |
{DailyCounterPerModule(myName; 1)} returns 5 |
DailyCounterPerUserPerModule
Signature |
{DailyCounterPerUserPerModule(name; numberLength)} |
Parameters |
name: any text |
numberLength: decimal number |
|
Description |
Increments and returns the counter for name for the user who creates the entity and for the module of the entity with length numberLength |
Returns |
Counter with length numberLength, or if the counter is not incremented this day for the user who creates the entity and for this module then 1 with length numberLength |
Example call |
{DailyCounterPerUserPerModule(myName; 1)} returns 5 |