Sort and order rows
By default, line items appear in the order Portant receives them from the source. If you want a different order (alphabetical by product, oldest invoice first, highest value at the top), you can set a sort.

How sorting works
Sorting reorders the rows that go into a repeating table before they're written into the document. It doesn't change the source data, only the order rows appear in the output.
You can sort by any field that's part of the line item set, ascending or descending.
Where to set the sort
The sort is set in the source-specific options, because each source exposes the line items differently:
- HubSpot. Open "Manage HubSpot Properties", select the connected object (for example, Line Items), and choose the field to sort by. See add multiple line items into a single document.
- Google Sheets. Sort the source sheet itself, or rely on the grouping column to control the order rows are read in.
- Webhooks. The order of items in the array is the order Portant uses. Sort the array in the system that's sending the webhook.
When sorting matters
A few common reasons to set an explicit sort:
- Quotes and invoices that should list higher-priced items first
- Statements that should be in date order
- Catalogues that should be alphabetical by product name
- QBR reports that should put the largest accounts at the top