Module 2 - Data Mapping & Transformation
Module 2 - Data Mapping & Transformation
1. Data mapping
2. Overview of formulas
Workato University
Working with Data in Recipes
1. By default, Workato’s smart connectors
introspect the data schema in connected
app/system and pull the standard &
custom objects as well as standard &
custom fields available for data mapping
Integrate. Automate. Innovate © Copyright 2019 Workato Inc. All rights reserved 5
Data Mapping: Data Tree
● Output data from trigger or action
step
● Contained within data trees, within
App Data section
○ Contains output from trigger
and every action preceding this
step
○ Text/String
○ Integer
○ Float
○ Object
○ Date
○ Date-Time
○ Boolean
○ Array/List
Data types inform about the Sample data: Shows
type and formula applicability on what kind of data the
a data value data pill stores
Integrate. Automate. Innovate © Copyright 2019 Workato Inc. All rights reserved 7
Data Mapping: Map Data Pills from Right to Left
App data:
Data pills are
Data fields: Fields and presented in a data
picklist associated tree on the right. An
with the app and output data tree is
object that you are generated for each
working with. step in the recipe.
Integrate. Automate. Innovate © Copyright 2019 Workato Inc. All rights reserved 8
Data Mapping: Mapping of Input Fields
Static/Constants:
Dynamic/Variables:
Combination:
Formula:
Integrate. Automate. Innovate © Copyright 2019 Workato Inc. All rights reserved 9
Data Transformation
Workato University
Formula Mode
Integrate. Automate. Innovate © Copyright 2019 Workato Inc. All rights reserved 11
Common Formula Examples
Formulas can be combined:
If-Else Conditions:
https://docs.workato.com/formulas.html#formulas
Integrate. Automate. Innovate Proprietary and Confidential 14
String Formulas
Workato University
Common String Formulas
Formula Function Example Result
" ".present? false
"nil".present? false
.present? Check the input for value
"Jean
Marie".starts_with?("Jean")
true
"Jean
Check if the input string false
Marie".starts_with?("jean")
.starts_with?(“text”) for the field value starts
with the text
"Jean
Marie".upcase.starts_with?("JEA true
N")
Replaces non-ASCII
.transliterate characters with ASCII
approximation
Remove whitespace at the " Jean Marie ".rstrip " Jean Marie"
.rstrip
end of the string
Integrate. Automate. Innovate Proprietary and Confidential 18
String Conditions: Slice
0 1 n-2 n-1
Address:
“Cupertino, CA 95014”
9 5 0 1 4
-5 -4 -3 -2 -1
“95014”
Workato University
Arithmetic operations
Formula Function
Pill A % Pill B Modulo -- divide pill A by pill B and return the remainder
_______ .round(n)
Data pill
-2 -1 0 1 2
Workato University
Relative Dates
Date: (Year) - (Month) - (Day) Time: (Year) - (Month) - (Day) T (Hour) :
(Minute) : (Seconds) (UTC offset)
Formula Function
● .strftime formula
● To change the format of a
datetime value
_______ .in_time_zone(“______”)
Data pill Time zone to
convert to
Workato University
Lists (Arrays)
_______ [ ____ ]
Data pill Index
0 1 n-2 n-1
-n -(n-1) -2 -1
Example Result
Example Result
number_list.first 100
number_list[0] 100
number_list.second 101
number_list[1] 101
number_list.third 102
number_list[2] 102
number_list.fourth 103
number_list[3] 103
number_list.fifth 104
number_list[4] 104
number_list.last 104
Example Result
Example Result
line-item[“item_qty”] 10
line_items = [ # list
{ 'item_name' => 'Acme widgets' , 'item_qty' => 10 }, # hash 1
{ 'item_name' => 'RR bearings' , 'item_qty' => 100 }, # hash 2
{ 'item_name' => 'Coyote tyres' , 'item_qty' => 7 } # hash 3
]
● .where
○ Retrieves only rows that satisfy the specified WHERE condition
○ Accepts a single argument in the form of a hash with one or more key-value
pairs
○ Default operand for the condition is equal to (==)
_____.pluck(‘_____’, ‘_____’)
Data pill Field Name/s
["a", "b",
Return true if given true
"c"].include?("b")
object is present
.include?
["a", "b",
"c"].include?("z")
false
Address:
“Cupertino, CA 95014”
“Cupertino, CA 95014”
Value if A is True
Workato University
Summary
● Data Mapping
● Different Formulas Types
○ String
○ Number
○ Date
○ List
● If-else statement
Workato University