DataChain formulas
Available in GenericsData &
HandleData
Formulas can be used to carry out more or less complex processing on datasets at different strategic levels in the value chain.
The unit functions available in DataChain allow you to create formulas of varying degrees of complexity.
Formulas manager
Formulas can be applied to Business Entities, DataBlocks and data sources selected in the various HandleData visualisations (Graphs, Tables, etc.).
The formula manager is used to build and define formulas to be applied to data sets.
You can create new formulas or use those in the formula catalogue.
image::formulas/formulas-manager.svg [Formulas screen]
Existing formulas in working context (1) +
Formulas screen
Activate or deactivate a formula (2)
Edit formula in list
Duplicate formula in list
Remove formula from list
Name of the formula selected or being created (Mandatory)
Formula description
Formula entry zone
Copies the formula currently being edited
Paste the formula previously copied
Opens the Formula Catalogue
Add the current formula to the formula catalogue
Display the formula as a tree
Click to create formula
Deletes all the formulas applied to the element or step in the DataBlock.
Closes the formula manager
(1) The notion of context refers to the page from which the Manager is opened. For example, if a Formula is added from a DataBlock step, the formulas presented in the list are those for the current step. (2) If a formula is inactive, then the column is still present in the table of values but the values are set to Null.
Building a formula
Each function expects one or more arguments.
The type of argument expected may be limited depending on the function.
Type of expected input value
Function prefix | Type of input argument str. |
---|---|
String of characters |
Numeric |
Numeric |
Date |
Date |
Boolean |
Boolean |
Boolean |
URL address |
Geographic |
Geographic |
List |
Lists |
Listings |
Numeric dc.,words., bin., file., http. |
DataChain specific |
To create a new formula, click on the New formula button, then enter a label and a description.
Then select the formula entry zone.
Building a formula image::ROOT:formulas-entry.svg[Enter functions]
Several functions are proposed from the list.
You can select and add formulas using the keyboard or mouse.
The functions are grouped by the type of argument expected as input. Start typing the formula prefix to refine the list.
Input zone
Search zone for a function
Available functions
Formula catalogue
Click to validate formula
Click to empty the formula input box
Cancels changes to the formula (editing only)
Defining function arguments
Every function has one or more arguments which must be defined.
The value that an argument can take can be of different kinds
-
a direct input of information
-
a column available in the source
-
a formula
-
a unit function
-
a value chosen from a closed list, proposed by DataChain
Some arguments expect a specific type of value.
For example
num.sinus(argument)
argument must be of numeric type (Integer, BigInteger, Decimal…).
In this case, the lists of functions, formulas or available values will only contain elements that match the expected type.
You can use the mouse or keyboard to position yourself at the argument(s) to be defined.
Example of entering a formula image::formulas-creation.svg [Formulas Creation]
Name of the + function
In the example of the str.split function, 2 arguments are required +.
Argument (1)
In the example, the column COMMON.
Separator
In the example, the hyphen in the 6 -
Displays formula in tree view
Details of the formula and expected arguments
(1) The list of elements depends on the type of attribute. For example, if the attribute is of type Integer, then elements of type Integer will be proposed and accepted.
It is possible to assign a formula from the catalogue as an argument to a formula.
In the function argument , click on
and select the formula you want to insert.
When the formula is complete, click on Validate .
To reset all the elements (label, function, description, etc.) of the formula, click on Empty.
To add the formula to the catalogue, click on the icon .
Formula catalogue
Each formula can be added to the catalogue for reuse.
The user who adds a formula to the catalogue becomes its owner.
The formula can be shared or not.
Shared formula
The formula can be used, duplicated and exported by all users from all projects, even if they were created from a private Project. + Only the owner can modify and delete it.
Only the owner can modify or delete it.
Non-shared formulas
Only its owner can view, modify and use it, from any Project in which they are a member.
Display the list of formulas in the catalogue
To display all the formulas in the catalogue select
.To add a new formula from the catalogue, click New then New formula.
Create your formula and fill in the metadata, then click on Validate.
To share the formula with other users, set the share button to ON.
Add a formula to the Catalogue
You can add a formula to the Catalogue from the Formula Manager, opened from an element (a DataBlock, for example).
Click on then fill in the formula’s metadata and whether it should be shared, and click on Save.
When adding a formula to the catalogue, the column references of the current element are replaced by a wildcard (/?/). The values of other arguments that do not refer to a column in the current data block are retained. |
Apply a formula from the Catalogue
Open the Formula Manager from the element page, then click on New formula > .
*
.
-
Select to display only the formulas of the current user
-
Select formula
-
Area detailing the selected formula
-
Cancels current changes and closes the Catalogue
-
Import or export a formula
-
Delete formula from catalogue
-
Enable formula sharing (if you are the owner)
Click on Assign * to close the popup and return to the formula creation page.
To assign a formula from the catalogue to an attribute of a current formula, position the selector at the function argument and click on
.