Hi All, need help. Can not find a suitable Google doc template example for generating a PDF for all records in a table when there are any updates. Anyone got templates to share? (not just one row record)
@Iling_Yeh I was intrigued by your question and decided to try. There is, of course, the Report options in AppSheet but I will assume you want an adhoc report generated off of some trigger (i.e. Workflow).
This is indeed possible by using the
<<Start: >>/<<End>> syntax and inserting a SELECT() statement. For example, I added the block below to a template I already have and it produced the list of Work Order info shown in the pic.
I hope this helps!
Result in File (spans onto second page - reason for black line)
You can do this by:
- Creating a email workflow rule that is triggered by an update to your table.
- Saving the workflow rule.
- Clicking the Create button following the Body or Attachment to create a default Body or Attachment template.
- Opening and editing the newly created default template.
- Add a Start expression before the first table field that looks like <<Start: Filter(TableName, true)>>
- Add an End expression after the last table field that looks like
The template field values between the Start and End will be repeated for each table record selected by the Filter expression. Since this Filter expression specifies the table name with the filter condition ‘True’ the Filter will select every record in the table.
If you would prefer to display the table records in an Excel table like way, insert a Google table in your template and put the
<<Start>> expression in the left most cell and the
<<End>> in the rightmost cell. See this article for examples of tables https://help.appsheet.com/en/articles/2697047-sample-email-templates
I see our posts crossed. Thanks for all the good advice you are posting in the community. Your posts are excellent and much appreciated.
Thank you very much John. Your example is very helpful. Can I ask couple more questions regarding template settings?
- How to group by a criteria? ex. vendor?
- My data consists of 4 photos, is there anyway I can set the size of the photos in the template?
Thank you very much. Appreciate your help.
You can sort the order with the ORDERBY expression like ORDERBY(Select(TableName[KeyColumn],TRUE),[Vendor],FALSE)
You can control the image size with the column width (inside of a table). Smaller width gives you smaller image. Another way is if you add a format rule for your image column.
Thank you. Will test the ORDERBY and image size column width.
My PDF files are now not showing correctly. I even tried the auto file generating option in the workflow, but it’s still scrambled.
Many thanks for helping.
Would you please take a printscreen from you template as well, thanks.
Thank you. Sorry it’s in Traditional Chinese, hope you can spot the bug. This problem is in both my workflows
@Aleksi Thanks for the expression. Is it possible to add to this expression so it gives a page break between vendors?
Thanks for your help
Wow, strange. Now this template’s PDF is back to normal showing all the data, but, the page orientation is still off. It’s set as landscape in google doc, but showing protrate in PDF.
However, the other workflow’s PDF is still scrambled.
@Phil Any idea what could cause this behavior?
To control the PDF page orientation, you need to specify the Page Orientation property for the attachment in the email workflow rule. Are you doing that?
No problem with orientation. Problem with PDF Chinese not showing up.
The other question is : how to set page break in template expression for different vendors
Problem with PDF Chinese not showing up. ---- Surprise! this problem is solved somehow.
Can someone help me with this? : how to set page break in template expression for different vendors