Block reference / Data

Data mapping

Copy chosen properties of the table or a variable into new names.

In both appsWarpX BrowserWarpX Phone

Data mapping reshapes data: it copies each source property you name to one or more destination properties, and drops the rest. Use it to rename table columns into the field names an API expects before you send them.

The Data mapping block's settings, filled in as in the example below.

Settings

Data source

Map every row of the workflow's table, or the value of a variable.

ExampleTable
Variable namewhen Data source is Variable

The variable to map. It must hold an object or a list of objects.

Exampleorders
Edit data map

Opens the map. Each row is a Source property and a Destination property; click Add source and Add destination to build it. Dots make nested paths, and one source can feed several destinations.

Example
name | customer.fullName
email | customer.email
email | contactEmail
Assign to variable

Store the result in a variable.

ExampleChecked
Variable namewhen Assign to variable is ticked

The variable that receives the result.

Examplecustomers
Insert to table

Put the whole result into one cell of the table.

ExampleUnchecked
Select columnwhen Insert to table is ticked

The column that receives the result.

Examplemapped

Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.

What it hands on

For the table or a list, a list with one mapped object per item; for an object, one mapped object. It goes to the variable or column you chose, and on as {{prevBlockData}}. The source itself is not changed.

Example: Rename scraped columns for an API

  1. Start
  2. Open URL
  3. Get text
  4. Data mapping
  5. HTTP request
Where Data mapping sits in the example workflow.
  1. Collect rows into table columns name and email, for example with Get text and Insert to table.
  2. Add Data mapping and keep Data source on Table.
  3. Click Edit data map. Add source name with destination customer.fullName, and source email with destinations customer.email and contactEmail.
  4. Tick Assign to variable and type customers.
  5. Add HTTP request and send {{variables.customers}} as the body.

Good to know

  • A source property an item does not have is skipped for that item, so its destinations are missing from the result.
  • A variable source that does not exist stops the block with Cant find "orders" variable. Text or a number stops it too: only objects and lists can be mapped.
  • The source variable name is used exactly as typed; references are not filled in there.

See also

  • Sort data — Sort the table's rows or a list variable, up or down.
  • HTTP request — Sends an HTTP request to a URL and can store the response.
  • Insert data — Set variables and add values to the workflow's table, several at once.