How to keep specified number of rows in a Email Attachment template

Hello,
I am trying to generate a pdf document using the Google Docs template and the template consists of a Table.
After generating the template the rows are dynamically added to the template. I donโ€™t want to add the rows dynamically in the template rather than have a specified number of rows in my pdf sheet. Is there a work around to achieve this.
Thank you in advance.

0 16 304
16 REPLIES 16

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Curtis_Rat

Welcome to the community !

Not sure about what you are trying to achieve, but from my understanding you may want to use a virtual column in your table in order to keep the TOP 10 (for example) rows of your template and run your doc generation based on this one.
Please see here:

That would be something like:
TOP([Related Children],10)

I am trying to use the pdf attachment feature of the appsheet. Iโ€™ve create a template an the google docs template consists of the following table.

While the pdf generation process the data is filled dynamically addling new rows to the google docs table. I would rather have a fixed amount of rows in the template and not dynamically add rows.
Hope you understand my problem.

Thanks for further information.

This kind of table is a pain to build, as it requires:

  • Separate table for headers only,
  • separate table for data only
  • separate table for โ€œsummingโ€ only
    Could be easy if column widths would stick to settings, but that do not.
    I recommend you make internal line to white in order to make these invisible.

Also, please have a look here for further guidelines:

Youโ€™ll need a separate <<Start>> and <<End>> tag pair for each row. Each <<Start>> tag must have a row list that includes only a single row.

Your current <<Start>> tag is this:

<<Start: [Related Loan Items]>>

To get only the first row from the [Related Loan Items] list, use:

<<Start: LIST(INDEX([Related Loan Items], 1))>>

To get only the second row from the list, use:

<<Start: LIST(INDEX([Related Loan Items], 2))>>

To get only the third row:

<<Start: LIST(INDEX([Related Loan Items], 3))>>

And so on.

Thank you for looking into the issue.This seems looked promising but upon testing it still adds and removes rows in the doc template , based on the number of entries in the database table.

I still want the blank rows in the template displayed even though there is no entry present in the Database table.

So basically it has to fill the rows iโ€™ve preconfigured in the google doc template where the data is present or not

Is there a way I could use an IF statement inside the Start Expression which states,

IF(Data is present at given index){
return(List of Data)
}else{
return(List of Blank Data)
}

Please post a screenshot of a report showing this unwanted behavior.

Hey Steve,


The above is the template I want to convert into pdf and send it via Email, the template is done in google docs through AppSheet.
Talking about the above template it has to have Seven Rows.

Now considering the solution you provided the google doc template looks like

If there is only one entry in the database the remaining rows in the template gets deleted and messes with the alignment of other items in the template

This is the generated pdf containing only two rows of data, I want the blank rows to be present in the report as well.
Basically the pdf report has to have 6 rows whether the data is present in the database or not .
Using <<Start>> and <<End>> Statements for each rows separately doesnโ€™t work because if there is no entry present in the database the row in the report template deletes itself, which causes other items of the report losing their alignment.

Try using a template-if for each line:

Something like:

<<If: ISNOTBLANK(INDEX([Related Loan Items], 1))>>

See also:

Hey Steve What if the value is blank, I still want the blank row to be displayed
<<If: ISNOTBLANK(INDEX([Related Loan Items], 1))>> if this expression resolves to be false.

I understand your requirement. Give it a try and see what happens. Weโ€™re experimenting here.

Hey Steve , I tried you suggestion , But it wasnโ€™t working for me when I tried

<<If: ISNOTBLANK(INDEX([Related Loan Items], 1))>> <<Start: LIST(INDEX([Related Loan Items], 1))>><<End>><<EndIf>>

This was not working for me, anyway I tried doing it like in the image below.

Now ,I want to show Blank rows where the List index Does not exist. Can you check and see if I can get it working somehow.

Maybe Get an IF-ELSE tags in place of just IF Tags.

Well, what you tried isnโ€™t what I suggested.

Iโ€™ll try to loop back to this if I have time to delve into it deeper.

Hi Steve ! I'm trying to achieve the same result as Curtis here, I have tried your solution, however when I run it in TEST it gives me errors all along the way..

Code :

<<If: ISNOTBLANK(INDEX([Related Routes], 1))>>
<<Start: LIST(INDEX([Related Routes], 1))>><<[Route_de]>>

Result :

Error 1 : 'RDV email' task 'Email Completed RDV' Attachment template. Expression 'If: ISNOTBLANK(INDEX([Related Routes], 1))' is invalid due to: Unable to find function 'IF: ISNOTBLANK', did you mean 'ISNOTBLANK'?.

Please post a screenshot of the template.

Hi Sorry for the delay I am currently away for work, I'll post it as soon as possible with the modifications, but right now it is like your first suggestion, and it's not printing the other 10 lines (Blanked) if I have only 1 item

 

Capture dโ€™eฬcran, le 2022-03-26 aฬ€ 11.06.30.png

Top Labels in this Space