Eledo PDF with Line Items from Integromat's array
Many document types like Invoices or Orders contain one or more line items of goods or services. Simple way how to print the line items table would be to create a table with more rows and populate only few of them. Table with empty rows does not look good at all and it also takes a lot of time to setup such template.
Eledo has an ellegant solution for this which is simple, powerful and prints number of lines precisely.
Eledo Template
Insert a table with two rows and multiple columns
Populate first row with table headers. Move cursor to second row and click Block Repetition.
Selected block is Table Cell at first. We want to repeat the whole row at once, so click on Select parent Block button to change it. Now simply populate the Data expression with line_items for example. Confirm the configuration with OK button.
Row becomes yellow and we can insert few Text Boxes into it. Cursor should be at the first cell, so you can directly click on Table Box. Populate Data expressions with line item columns and confirm. Repeat for every column.
Last column displays line total, which we can calculate directly in Eledo template. Most basic data expression for it would be Quantity * Price But as many of us knows, the total is usually rounded and printed with two decimal places. We therefore recommend to use this data expression instead: CURR(ROUND(Quantity * Price, 2), 0, 2)
Save the template and your automation is ready!
Integromat scenario
Our Eledo template with line items array should look like this
Here we have few options how to populate it. First and intuitive way would be to Add item and populate column values. But this is not the correct way. If we want to print dynamic amount of lines every time, we will have to use map toggle and populate line_items with an array. Here we have two options.
Easy way
First one is simple and straight forward. Simply put the array field into line_items and that's it. In this case it is important to check, whether the source array structure matches the expected array structure for the template. If it does not match, you may end up with missing values in your PDF.
If the two array structures does not match, you can simply align the field names in Eledo template to match your source array structure. Therefore this method requires some planning before you create Eledo template, if you don't want to do things twice.
Advanced configuration
For those who would like to map between two arrays or build line items from multiple data sources the second method exists. It gives you more control over the process, but also costs more Integromat's operations. It consists of Array Aggregator and some kind of array source, like Iterator or Repeater.
You can populate Iterator's Array with your source array. The important configuration is done in Array Aggregator, where the mapping is done. Open it and select a Source Module to be the Iterator, Target Structure to be Eledo's line items and then you can map your values into your PDF tempate's structure.
Last thing to complete this mapping method is to populate line_items field in Eledo module with array prepared by the Aggregator.