For example, we can create a custom table using a loop to filter the referenced results to create a PDF invoice.
The Podio Workspace is set up as follows:
When a Work Order is set to Complete it creates an Invoice Item. The flow to create the PDF Invoice is set up as follows:
Start your flow to Trigger on Item Created from Invoices (App D).
Add Get Referenced Item and set up to follow to Work Orders (App B) and then to Time Sheets (App C).
Add another Get Referenced Item and set up to follow to Clients (App A).
Add the Sort Collected to sort the collected Time Sheets by Date Ascending.
Add a Custom Variable/Calc and create a PHP expression to start a detail table.
Note that any table formatting must be done here
This Calculation creates a Table Heading with three (3) columns - "Date", "Summary" & "Duration". We have also added CSS to give the table borders and span the width of the page.
Add the For Each and set to the referenced items collected to use in the Table.
This is set up "for each" referenced Time Sheet.
Add a Sanity Check to check IF the referenced Time Sheet status is "Ready to Bill".
Add another Custom Variable/Calc action brick. Title this Variable the same as the table created above. Create a PHP expression to add the data from the Time Sheet to the table variable created above.
Note that Formatting can be added to each column to format the data output.
Here we have formatted the date to output as numbers in the m-d-Y format and the duration to be a whole number to 2 decimal spaces.
Add an Update Collected action to Update the Item added to the detail table.
This step will change the Time Sheet from "Ready to Bill" to "Invoiced"
Add the End IF to close the Sanity Check.
Now add the </> Continue action to stop the loop and continue on with the actions.
Add another Custom Variable/Calc to close the table.
Add Make a PDF. Be sure to add the Custom Variable you created in the PDF body.
The final PDF is shown below. See Advanced Formating for more customization.