Rule editor is the core aspect of transformation. The configuration of every rule can be specified in this section.
1. Target Attribute
The name of the attribute in the target list. For choosing a name the following options exist:
- Choosing the same name as an attribute in the source: In that case the source attribute will be overwritten from this point onwards.
- Choosing the same name as the target of some rules before this rule: In this case the value of that attribute will be overwritten from this point onwards.
- Choosing a totally new name: A new attribute with this name will be stored in the target.
Please note that the processing of the rules are one after another in the specified order. If a few rules with the same name exists, only the latest rule, which is the one specified last will be considered.
After choosing the name, it will appear on the left side in the Rules
section, in order to facilitate choosing and finding this rule in later.
If the optional toggle next to the target name As Script
is activated, the target itself will be evaluated as a Chioro Expression, and the result of that expression will determine the “real” name of the target.
This is an advance concept which is useful in certain rare use-cases.
2. Type of Rule Evaluation
This set of buttons determine which type of evaluation has to be performed. The first/default mode is simple, the value specified in the Target
attribute will be the name of the target and the assignment script will be applied and the result will be saved as this name. The second option is script,
here the name will be determined based on the script written in the target. For example, if the target is "a" + "123"
, the value assignment
will be saved in a123
target attribute.
The third and final mode is multi-attribute mode. In this mode, one rule can apply to multiple attributes. How these attributes are selected is based on text filtering mechanisms such as regular expressions. Once this mode is selected, the screen will modify to include the following extra configuration:
- Source Filter Attribute: In this field a search string or regular expression has to be specified. The example above searches for attributes color and category.
- Target Attribute: In this field, the user can specify a script, which indicates the new name of the attribute currently processed. If not specified, the default function
current()
will be used to indicate no changes are required.
Please note that in this mode, very often it is required to point to the value or the attribute currently being processed. In this example,
the color
and category
attributes have to be replaced with attributes of the same name, however the values should have “some suffix” appended to them. To point
to the value of the attribute currently being processed, $(current())
or shortcut $()
can be used.
3. Condition
If specified, the rule will be considered only when the entered Chioro Expression is evaluated to true
. There are certain tools under toolbox that can help formulate such conditional Chioro Expressions.
4. Comment
Free text to specify any remarks, comments or documentation about the rules. The comments do not affect the execution of the rules in any way.
5. Value Assignment
Here is a special text box designed to facilitate working with chioro expression.
The result of this expression is stored in the field with the name specified in Target
. The tools under the Toolbox
are specially useful in this section.
Please note that the tools inside the toolbox can be easily dragged-and-dropped in the corresponding sections of the rule editor, as seen in the screenshot below.