Overview
Whether you're just starting out or are an advanced builder in Tines, transforming your data throughout a story is vital to success. In this article, we cover some common methods using simple scenarios for restructuring event data within your stories to fit your needs.
Tines references
Before getting started, we recommend familiarizing yourself with the functionality this article covers:
Make it happen
Both sections below use the following array:
{
"items": [
{
"name": "Gala Apple",
"type": "apple"
},
{
"name": "Honeycrisp Apple",
"type": "apple"
},
{
"name": "Macintosh Apple",
"type": "apple"
},
{
"name": "Blueberry pie",
"type": "pie"
},
{
"name": "Raspberry pie",
"type": "pie"
},
{
"name": "Strawberry pie",
"type": "pie"
}
]
}Loops and tags
In this video, we look at how to handle an incoming array and modify it to meet specific criteria.
The criteria in this scenario is to:
Add "is delicious" after every
namekey value where "pie" is mentioned (i.e., "Blueberry pie is delicious")Capitalize the
typekey value
We enable a loop in our Event Transform action to cycle through each object within the items array. We then use an if tag and the INCLUDES function to iterate through each looped name key value to check if "pie" exists. If it does, we add the "is delicious" string to it. If it doesn't, we leave the name key value as is. We also use the CAPITALIZE function to capitalize the type key value.
We re-emit last event from the "Catch Results" action and see the results of our pie formatting in the events of the "Format array" action.
Organize event data
In this video, we look at how to take an incoming array and break it up based on a key identifier. In this example, we leverage the type key value of "apple" or "pie."
To create our categories (apple and pie), we use the explode mode of the Event Transform action. Since we only want to grab these specific values, we use the MAP and UNIQ functions to create a list array that includes one instance of each as the Explode Path.
This creates an event for each category. Now that they're established, you can organize the original array. Using the WHERE function in a subsequent Event Transform action, we compare the original array's type key values against the categories we created in the Explode to see if there are any matches.
After re-emitting from a previous event, we can see how the final Event Transform action is showing only the pie results.
Review the results
Mastering data transformation in Tines is key to building effective and efficient stories. By applying the methods outlined in this article, you can tailor your data structures to meet your specific requirements, improving the performance and clarity of your story flows.


![An Event Transform action named "Explode 1 of each type" with its configuration panel open. The formula field on the left is highlighted, showing UNIQ(MAP(format_array,"type")) with the result ["Apple","Pie"] highlighted at the bottom. The Build panel on the right shows the Mode set to Explode (highlighted), the Path field set to the same UNIQ(MAP(format_array,"type")) formula (highlighted), and the To field set to individual_item.](https://downloads.intercomcdn.com/i/o/am0g137l/1224109237/fb7bc536ff943ab8f89a813d7d1e/image.png?expires=1776398400&signature=7d188510dcc25fc04c4cc6b1f6d886c7d10c319879fa31f71a8400115e0d8f6e&req=dSIlEsh%2BlINcXvMW1HO4zeYDwunnLT83vsOO5N6V2X2IlvwcWosznkazRbN9%0AFhnPIy%2BYzREoNlzW%2Bjs%3D%0A)

