Chioro expressions are used in various operations of Chioro. They allow the construction of complex rules. They can also be extended and reused.
Anatomy of a Chioro expression
A Chioro expression can consist of several input parameters, processes one row of the table and produces only one output parameter.
name(parameter1, parameter2, ..., parameterN)
- name: name of the expression.
- parameter1..N: input parameter
Example:
concatenateText('hello', ' ', 'world')
which produces the text “hello world”. This text can end up in one of the target fields or be used as part of a larger transformation.
Input and output types
Input parameters can be of the following types:
- Text: with
""
chioro expression | result |
---|---|
concatenateText(“hello”, “ Josef“) | hello Josef |
- numbers:
Chioro expression | result |
---|---|
1+2 | 3 |
- Read column contents from source:
$('column')
returns the value from the cells of the respective column and row.
Sku | Name | Description | Chioro expression | result |
---|---|---|---|---|
123 | product1 | best product | concatenText($(‘sku’), ’ ’, $(‘name’)) | 123 product1 |
- Regular expression: To formulate search. More information
description | chioro expression | result |
---|---|---|
pants for women | decode($(‘description’), /women/i, ‘F’) | F |
- data table: Chioro compares the column contents of the source with the column contents of a prefetched data table
color | Chioro expression | result |
---|---|---|
RED | lookupHole($(‘color’), ‘colorCodesToGermanNames’) | red |
Chioro expressions can be concatenated, which allows powerful combinations. e.g.: concatenateText(textInCapital(“hello”), “ Josef“) -> “HELLO Josef”
Output Parameters can output the following types:
- Text or numbers
- list: a list of output
chioro expression | result |
---|---|
asList(“a”, “b”) | [“a”, “b”] |
- Empty: If no value is present
Chioro expression | Result |
---|---|
extractAusText(“nen”, “tomato”) |
- truth: true or false
age | chioro expression | result |
---|---|---|
13 | $(‘age’) < 15 | true |
If a function is not available as a tool, you can implement it as standard javascript expressions implement them. All javascript expressions are available as chioro expressions.