An action is a specific step in a processing pipeline that performs a specific task on an item being processed. In the context of the documentation provided so far, an action is represented as a key-value pair in a YAML file, where the key is the name of the action (e.g. “remove_unwanted”) and the value is a dictionary containing details about how the action should be performed.
A processing pipeline is a series of actions that are applied to an item in a specific order, with the goal of transforming or manipulating the item in some way. In the YAML examples provided, each action is a key in the actions dictionary, and the processing pipeline consists of all the actions listed in the actions dictionary.
For example, in the following YAML file:
actions: remove_unwanted_fields:
action: remove
keys: [GROUP, TYPE, UID, ATTRIBUTE_CODE, DUMP_TIMESTAMP, MEASUREMENT_FAMILY]
add_timestamp:
action: add_field
field: TIMESTAMP
value: "{{ now() }}"
rename_fields:
action: rename
mapping: { OLD_FIELD_NAME: NEW_FIELD_NAME, OLD_FIELD_NAME_2: NEW_FIELD_NAME_2 }
The processing pipeline consists of actions: remove_unwanted_fields, add_timestamp and rename_fields. These actions will be applied to the item in the order they are listed, starting with remove_unwanted_fields and ending with rename_fields.
Through the Induxx Middleware (https://app.induxx.be/#/trans/dashboard), you can access the Transformations App.
At Tasks you will find the tasks already created for you by Induxx.
If you click on a task, you will be taken to the following screen:
BC Import is a task that imports data. As you can see in the image above, this task is executed automatically.
The image below is the main page of the manual task CMEM export.
From this page, you can run the task or you can choose to edit the task. When you press run, the task is executed immediately.
As you can see in the image above, while the task is running, you can monitor the log and you can also end the task manually by pressing stop.
When the task has completely run, you will see the screen below.
By clicking download you can download the results of the task. This zip-file will contain the transformed file as well as a file with unprocessed items (if any).
If you choose edit from the main page of the task, you will see the screen below.
If you want to change anything about the underlying code, you can download the scripts to your computer.
When you want to upload the custom code, you need to zip it. Next you have to click the x at the “Transformations” field. Now you have the option to upload the zip-file in this field. When you are asked what the main file of the transformation is, you have to indicate main-STEPS.yaml.
Here’s some examples of how you might use the modify action in a YAML file:
This modifier allows for html entity decoding of string values. HTML string values can be decoded for quotes or xhtml This modifier expects and modifies the Cell value.
actions:
decode_special:
action: modify
modifier: decode_special
keys: 'encoded_string'
decoder: quotes
This modifier filters or removes any empty values. This modifier expects and modifies the item array.
actions:
filter_empty_string:
action: modify
modifier: filter_empty
This modifier filters or removes any whitespaces from values. This modifier expects and modifies the item array.
actions:
filter_white_spaces:
action: modify
modifier: filter_whitespace
This modifier transforms a string value from one character encoding to another. This modifier expects and modifies the cell value. Locale is optional and lets you set the locale before running iconv (see # php.net for more info about the iconv-function in PHP).
actions:
iconv_encoding:
action: modify
modifier: iconv
keys: 'text_value,another_text_value'
in_charset: 'UTF-8'
out_charset: 'ISO-8859-1'
locale: 'en_US.utf8'
This modifier transforms an empty string value to null. This modifier expects and modifies the item array.
actions:
nullify_empty_string:
action: modify
modifier: nullify
This modifier transforms a string value into a reference compliant string based on the following rules. The value response may contain only letters, numbers and underscores. All other character will be replaced by an underscore. This modifier expects and modifies the cell value.
actions:
reference_code:
action: modify
modifier: reference_code
keys: 'reference_field'
This modifier will replace any characters with any other complaint character in your system. This modifier expects and modifies the cell value.
actions:
replace_char:
action: modify
modifier: replace_char
keys: 'reference_field'
characters:
Š: S
š: s
™: TM
®: trademark
©: (C)
This modifier transforms a string value into a snake_case compliant string based on the following rules. The value response may contain only lowercase letters, numbers and underscores. This modifier expects and modifies the cell value.
actions:
snake_case:
action: modify
modifier: snake_case
keys: 'text_values'
This modifier transforms a string value with upper cases into a lowercase value. This modifier expects and modifies the cell value.
actions:
string_to_lower:
action: modify
modifier: lower
keys: 'text_values'
This modifier transforms a string value with lower cases into an uppercase value. This modifier expects and modifies the cell value.
actions:
string_to_upper:
action: modify
modifier: upper
keys: 'text_values'
This modifier transforms a string value by stripping the unquoted string or remove the escaped character. This modifier expects and modifies the Cell value.
!WARNING!
stripslashes can be used if you aren’t inserting this data into a place (such as a database) that requires escaping.
actions:
strip_slashes:
action: modify
modifier: stripslashes
keys: 'text_values'
This modifier transforms a string value by stripping the html elements from your string. This modifier expects and modifies the cell value.
actions:
strip_tags:
action: modify
modifier: strip_tags
keys: '<p>html_content</p>'
This modifier transforms a string value by raw url-encoding according to RFC 3986. This modifier expects and modifies the cell value.
actions:
url_encode:
action: modify
modifier: url_encode
keys: 'url_values'
This modifier tries to autodetect and transform the encoded string to the UTF-8 standard. Akeneo expects UTF-8 character encoding so this modifier is mostly used during import. This modifier expects and modifies the cell value.
actions:
utf8_encode:
action: modify
modifier: UTF-8
keys: 'text_values'