Action or workflow PDF google doc template examples for generating all records in a table

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!

Block Added

Result in File (spans onto second page - reason for black line)

2 Likes

You can do this by:

  1. Creating a email workflow rule that is triggered by an update to your table.
  2. Saving the workflow rule.
  3. Clicking the Create button following the Body or Attachment to create a default Body or Attachment template.
  4. Opening and editing the newly created default template.
  5. Add a Start expression before the first table field that looks like <<Start: Filter(TableName, true)>>
  6. Add an End expression after the last table field that looks like <<End>>

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

3 Likes

Hi John,

I see our posts crossed. Thanks for all the good advice you are posting in the community. Your posts are excellent and much appreciated.

1 Like

Thank you very much John. Your example is very helpful. Can I ask couple more questions regarding template settings?

  1. How to group by a criteria? ex. vendor?
  2. 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)

1 Like

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.

1 Like

Thank you. Will test the ORDERBY and image size column width.

Help!

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

second work flow with scrambled pdf

@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

Thank you

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