Transform Your data
What to Expect in This Guide
Data transformation enables you to create more meaningful content by adding phrases to the values and setting up the data applied to the selected function. This guide will give you an overview of several components that can be used to transform data. It shows how to implement mapping nodes as well as the purpose of lookup tables. In any, or both cases, you define an input, and apply the changes to it.
Transforming Values With Mapping Nodes
Any kind of modification of your data can be done with a mapping node. This includes many different applications:
One possible scenario is to fix spelling errors or handle upper and lower case.
Another option is to insert mapping nodes for several list functions, such as counting, filtering and sorting.
And you also can use it to do calculations with data values that can vary.
Anything you have to change in your data, so you can use it in the text, you can do within a mapping node.
Structure of Mapping Nodes
First of all every mapping node has a unique name, similar to the other node types. The input ports are used to put the needed data into this node. By clicking on Add Parameter, a parameter will appear with the corresponding port. The number of input ports depends on the functions and data values that you want to involve.
The truth port accepts truth values from other nodes. It determines if the output can be used (green light) or not (red light), depending on the defined logic. The mapping expression is the part of this node that tells how the data has to be modified. You can use the functions in our documentation to apply the operations to the input data. The output port delivers the output of this node and can be connected to another node. The data flow is from left to right. You use an input to get a specific output, in general you map an input to an output. The preview shows the output of the node with the current settings. It helps you to make sure that you have set everything correctly.
In this example two values are combined in a mapping node so that the output can be called with one phrase variable.
Modify Data Values
One single mapping node can be sufficient to change the value for all affected datasets. On a side note, regular expressions can also be implemented for that. In the following, you will create a mapping node to replace a value.
Create a Mapping Node!
- Use a mapping node to remove values and clean up data.
Applying List Functions
Several list operations like count, unique and filter can also be applied by using mappings. The input in this case should be always a list. Either you already have a list in your data, or you can create your own. The following tutorial shows you a good use case for the sort function.
Implement a Sort Function!
- Use a mapping node for sorting values in a list.
When having lists and you want to apply the condition or function on each element of the list you can make use of the filter and map function. You always refer to a list that you want to apply the filter or map to. Within the  you can define your custom modification.
|filter(list, object/lambda_expression)||filter(#players, [element -> #element.goals > 5])|
|map(list, lambda_expression)||map(#options, [element -> lower(#element)])|
The following tutorial shows you a frequently asked scenario for the filter function.
Implement a Filter Function!
- Use a mapping node for filtering values in a list.
In this tutorial you will learn the use of a map function.
Implement a Map Function!
- Use the map function to apply a function on every element in a list.
Additional Information by Using Lookups
Lookup tables are an easy way to transform the data and add more information. There are several scenarios in which the tables are used:
- For translating the data values.
They enable you to create a multilingual project data even if the data is only available in one language
- For enriching the data by assigning phrases.
The enrichments give the text individuality and deliver more valuable content to the reader, thus increasing the text's quality.
In addition, these tables are a very clear option to display a lot of information.
The Structure of Lookup Tables
The lookup tables are displayed as a typical table with a key-value structure. As key you add the value from the data, it has to match the string you want to replace. As value you add the phrases you want to assign to the key. If you have a multilingual project, you can add the corresponding entry for every language.
Match the Table With the Data
Once you have set up the lookup table with the entries, you have to connect the table with the data node. Here you need a mapping node to merge the two inputs.
Integrate a Lookup Table!
- Create a lookup table and use it in a statement.
If you want to take a closer look at transforming values with mapping nodes, check the webinar Mapping - Next Edition