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.


fit

The fit function is used to produce a fit vector by fitting a data column with a given distribution, which can be grouped if required.

Attention

This function belongs to the distribution functions subgroup.

Parameters

fit(column, distr, params, group, method, maxit, tol)

Parameter

Description

column

The attribute which will be fit within the given distribution. The column parameter is mandatory.

distr

The distribution which will be used. If no value is specified, uniform distribution will be used. To know the other distributions available and their parameters, go to the corresponding page.

params

The parameters of the corresponding chosen distribution. If the column is empty, or some cells are empty, it will be filled with the fitted values of the parameters. To know more about how these parameters can be specified, go to the corresponding page.

group

The attribute used to group results. Multiple attributes can be specified, as long as they are enclosed in double brackets.

method

The estimation method to be used. The available method is mle (maximum likelihood estimation).

maxit

The maximum number of iterations to perform the fit. If it is not specified, the number of iterations is 10,000.

tol

The desired tolerance for the fit. It must be a positive value.

Example - fit (column, distr, params, group, method, maxit, tol)

The following example uses the Adult dataset.

  • After having imported the dataset, add a Data Manager task onto the stage and link it to the import task.

  • Double-click the task to open it, and add two empty attributes, which we have called mean age and stdev age,

  • Write $"null" in the left-hand operator of the formula bar, then type the following function: fit ($"age", "gaussian", mean = $"mean age", stdev = $"stdev age", group =$"sex")


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 multi 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.