How to use Line-Items with Formatter#

Line-items are a special type of Zapier field that contain a list of multiple values (also known as an array). Many invoicing, accounting and form applications support line-item fields as a way to more easily represent their data. You can identify this type of field in Zapier when you look at the results of a Test Step and see a list of numbered rows. Here is a simple example with one value per line:

fruit

and a more complex example with many values per line:

lineprice-transform-1

Zapier will take this output and create line-item fields for use in the next Zapier Step, but what do you do when you need to transform each of the values in these line-item fields? That is where Formatter comes in, it is now "line-item" aware. Any transform that works on one field value will now work on all values in a line-item field. Here are some examples of how to use Formatter with these line-item fields:

Transform each date in a line-item field#

Date formatting is very application specific, especially as you move between different geographies. Here is how to transform a line-item date field from a US date format to an EU format using the Formatter Date/Time Format Transform:

Trigger application provides line-item US dates:#

ldate-1

Formatter Step with date transform for EU date format:#

date-2

Results of Formatter Step with dates in EU format:#

date-3

Calculate line price for each product purchased#

Some online sales applications provide the quantity of each product purchased, the price of each product purchased, but no line price for each product. Here is how to accomplish that with Formatter, two line-item fields and the Spreadsheet-Style Formula Transform.

Trigger application provides line-item price:#

lineprice-transform-1

Trigger application provides line-item quantity:#

lineprice-transform-2

Formatter Spreadsheet-Style Formula Transform calculation that multiplies line-item values from each field:#

lineprice-transform-3

Results of Formatter Step (Quantity * Price):#

lineprice-transform-4

Currency formatting#

Many invoicing applications are currency agnostic, so if you need to take those generic invoice amounts and format them for a specific currency, here is how you would do that with Formatter, a line-item field and the Format Currency Transform:

currency-transform

Transform SKUs from an online sales application to an invoicing application#

Many invoicing applications require the use of their specific product SKUs. Many on-line sales apps generate their own unique product SKUs. How do you then, match the product purchased with the product invoiced? Formatter's Lookup Table Utility and line-item fields, that's how:

 

Create Line-Items using the Split Text transform#

Not all Trigger apps are capable of providing data in line-item format (in order to add lines to an invoice Action, for example). Luckily, we have a way to do it using Formatter's Split Text function.

In the following example we're going to take the 'New Row' Trigger for Google Sheets and use the data from 3 different columns in that row to create multiple line-items.

We'll then use the Google Sheet 'Create Spreadsheet Row' Action that supports line-items, in order to create 3 separate rows from our original data.

Check out this quick video to see how it's done:

 

Exceptions#

There are three transforms that do not support line-items today:

  • Number "Perform Math Operation" - you can use the "Spreadsheet Formula" to do math on line-items.
  • Utilities "Pick from List"
  • Shorten URL
↑ Was this documentation useful? Yes No (Suggest Edits)
Get Help