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:
and a more complex example with many values per line:
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:
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:
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.
Formatter Spreadsheet-Style Formula Transform calculation that multiplies line-item values from each field:
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:
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:
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 Line Itemizer Utility
Let's say you’re using QuickBooks Online and you need to create multiple line-items in an invoice with the following information:
You can use one Formatter step to convert that data into the Line-item format that the Invoice Step needs.
Some e-commerce applications provide shipping as a separate item, with its own set of fields. Many invoice applications want shipping as a standard line in the line-item fields your Zap provides. The Formatter Line Itemizer Utility can facilitate this by appending (or prepending) the shipping value(s) to these standard line-item fields.
If you’d rather prepend the values so that the shipping line shows up first, then put the shipping values into the fields first, add a comma, and then map in the line items that you’re prepending to, like this:
Some apps, like Quickbooks Online, require an
Amount line item property to be supplied in addition to the
Quantity fields that you're getting from your Trigger app. The
Amount field should be equal to
Price multiplied by
If your Trigger app does not supply this value and your quantities are higher than 1, you can perform this calculation for multiple line items using either the Formatter Numbers Action (Spreadsheet Style Formula) or the Formatter Utility Action (Line Itemizer). Let's take a look at Line Itemizer.
First, map in your existing Line item values and change the
Create Subtotal Property? field from
Here's the first two line items from testing that step where we can see the Subtotal has been calculated:
In your Quickbooks Online or other action requiring a
Amount value, you can map in the resulting Subtotal property along with the
Quantity properties in their appropriate fields.
The Subtotal calculator also works great when you're appending values such as a shipping line item to your line items:
There are some instances when you need your Line-item field as formatted text so it can be used in an Action that doesn't support line-items. This is sometimes referred to as "flattening" a line-item. Tags are an instance of this, as it seems each application uses their own format to delineate multiple tags, and most don't support line-items. Hubspot is an example here, it uses a string of text, with each tag delineated by a
; Here is how you'd get this Tag format for Hubspot using the Line-item to Text Utility:
Let's run the category field this through the Line-item to Text utility, replacing the
If you need to use a specific value that is part of a series in a line item in your Actions, you can separate those values. One way to do that is to map the line item into the input of the Line Item to Text Utility:
Note that you don't need to enter a separator. This utility is also used for 'flattening' line items into a single piece of text, and you can add the separator between each value. The separator won't be added to the individual values. Let's take a look at the output:
You can see that each part of the Line Item was returned as
item_n. The first value in the Line Item will always be
item_1 and the last item is repeated as
item_last in case you always need to extract the last item from the Line Item property being input into this transform.