Skip to content

Scripted Processes

Processes can either have mappings which build dimensions, hierarchies, cubes and aliases or a script which can do a wider range of activities.

MODLR Supports two scripting languages; JavaScript and R.

To use scripting in a new process, change the Action to Custom.

Creating new scripted process

When writing the scripted process there are four functions which are needed in the process.

pre()This function runs before the process is executed and is used to provide the user with prompts for additional information required to run the process.

See also:
_script.prompt() function in the process function reference._
begin()This function runs once at the beginning of the process once the prompt data has been collected from the user. Use this function to create new objects or to wipe existing objects ready before loading data.
data(record)This function runs once for each line in the datasource. If there is no datasource then this function is not executed. Data values can be returned from the record using the field name.

If the datasource table provides a field called "account_code" this value can be accessed using "record.account_code".
end()This function runs once at the end of the process. Use this function for cleaning up created objects or notifying users of the processes result.