Null functions¶
Null functions are all the functions which can be used in the Formula toolbar of the Data Manager without the definition of a Left term since they do not return any result.
Therefore, Left member of the Formula toolbar needs to be set to $null
value to use these functions.
The following functions are available:
breakLoop¶
The breakLoop function conditionally stops the module iteration in a module loop.
To know more about modules, go to the corresponding page.
Parameters
breakLoop(condition)
Parameter |
Description |
---|---|
condition |
The condition which must be satisfied to make the function work. If it is true, and used inside a module, the loop computation stops. If it is true, but it is used outside the module, an error is raised. |
errorGold¶
The errorGold function checks whether a specific condition is true, and returns the error message and an error code.
Parameters
errorGold(condition, message, code)
Parameter |
Description |
---|---|
condition |
It is the condition which is evaluated. If true the provided error message is returned. The condition parameter is mandatory. |
message |
The error message to return if the condition is evaluated as true.The message parameter is mandatory. |
code |
The error code to return if the condition is evaluated as true. Default code is 9020. |
Note
Rulex Platform consider valid error code all the number between -10000 and 10000. Any number outside this range will decrease the error to a warning.
Example - errorGold(condition, message)
The following example uses a simple dataset we have created on our own, using an Empty Source task and filling the values randomly through a Data Manager task.
In this example, we want to return an error if the number of rows of the dataset is 0.
We type the following formula:
errorGold(len(enum($"Var_0")) > 0,"No data present")
.If the provided dataset has no row, an error is returned with code 9020.
warningGold¶
The warningGold function checks whether a specific condition is true, and returns the warning message.
Parameters
warningGold(condition, message)
Parameter |
Description |
---|---|
condition |
It is the condition which is evaluated. If true the provided warning message is returned. The condition parameter is mandatory. |
message |
The warning message to return if the condition is evaluated as true.The message parameter is mandatory. |
Example - warningGold(condition, message)
The following example uses a simple dataset we have created on our own, using an Empty Source task and filling the values randomly through a Data Manager task.
In this example, we want to return a warning if the number of rows of the dataset is 0.
We type the following formula:
warningGold(len(enum($"Var_0")) > 0, "No data present")
.If the provided dataset has no row, the warning message is presented.
multiplyRows¶
The multiplyRows function repeat any row a number of times equal to the integer value contained in that row in the provided column.
Parameters
multiplyRows(multi)
Parameter |
Description |
---|---|
multi |
The integer column used as a row multiplier factor. The condition parameter is mandatory. |
Example - multiplyRows(multi)
The following example uses a simple dataset we have created on our own, using an Empty Source task and filling the values randomly through a Data Manager task with integer values.
We suppose for this example first column Var_0 is integer and filled in the first three rows with value 1,2,3
We type the following formula:
multiplyRows($"Var_0")
.After formula execution, the first line is left untouched, the second line has been doubled while the third line has become three times.