I am using a Google Doc as a template. My data is organized using tables (Doc Tables, not data tables) within that doc. Is there a way to conditionally display rows? I need to NOT show a row when a field is empty.
Generally, you would add rows in a template through lists of key columns in <<START>> expressions, something like
<<START: Table_Name[Key_Column]>> .... <<END>>
To exclude a row with specific condition, you could modify the list expression something like
<<START: SELECT(Table_Name[Key_Column], ISNOTBLANL([Column_Name]))>>...<<END>>
Where the [Column_Name] is the column that you do not wish to be blank for its row to be included in the template.
Edit: Sorry that, in first reading, I missed the part of sentence you mentioned as follows
@RogerCreasy wrote:
(Doc Tables, not data tables)
Could you elaborate above because it could change the response or sugegsted solution.
@Suvrutt_Gurjar WHat I mean is, I don't want my PDF to have empty table cells. e.g.
In this example, if Field1 is empty, I want to hide the entire row in the final PDF
Okay, if you are using <<START>> expressions , then my suggested solution should work. In AppSheet, for a list, the required number of rows are added by the automation itself in the produced report. So if there are 10 rows, you need not make a Google doc table of 10 rows. Of course the list should be created by the <<START>> expressions.
Did you get a chance to take a look at the hep article on START expressions?
Use Start expressions in templates - AppSheet Help
OK. I did read the article. I am still not sure how to generate the formatted table rows. Are there any examples anywhere?
Could you elaborate what mean by "formatted table rows" with some screenshots or examples. I believe the article shared has some good examples of templates.
Like my example above. I don't want empty rows in my Google Doc Table.
Perhaps I need to switch to an HTML template?
Your explanation seems to address leaving out data. I need to not have the Google Doc Table Row display if <<[Field]>> is empty.
I don't see an example of adding a Google Doc Table Row using <START> statements
I request you to again take a look at the shared article and my earlier posts.
The expression I shared will eliminate rows that have [Field] empty.
@Suvrutt_Gurjar wrote:
To exclude a row with specific condition, you could modify the list expression something like
<<START: SELECT(Table_Name[Key_Column], ISNOTBLANL([Column_Name]))>>...<<END>>
Also as previously mentioned, AppSheet automation will automatically add only those many rows in the output report as the list of <<START>> expression has. So if the <<START>> expression list consists of 7 row keys, AppSheet automation will include the columns of those 7 records in the output report.
It is likely that I have misunderstood your question. In that case, I am sorry and maybe someone else from the community could answer you. If you do not get another response in this thread in reasonable time, maybe you could start a fresh new post thread.
OK. So, I put this code outside of the Google Docs Table? What tells Google Docs to create a table?
Here is an example of the template <<START>> expression.
Please take a look at the following sample app that has many relevant report templates taht you may want to study.
Order Capture How-to - AppSheet
If the <<START>> expression has 8 keys, the AppSheet automation will automatically create those many rows on runtime while creating the report.
Below is an example of the report created through the above template after the automation ran. The 3 rows are automatically added by the automation.
Ahhh!!!
THanks! This explain swhat I didn't understand. Thank you! I will give it a go.
From what I recall using tables in GDocs and attempting to hide rows becomes difficult because even a table with <<If>><<EndIf>> conditions will likely generate a blank row and GDocs does not allow to set the table row height to 0 for blank data. An HTML template may in fact be easier to implement but you still need to figure out the proper order for <<Start>><<End>> and then where to put your If condition. This could look like this:
<table>
<thead>
</thead>
<tbody>
<p><<Start: YourData>></p>
<p><<If: ISNOTBLANK([YourColumn])>></p>
<tr><td><<[ColumnData]>></td></tr>
<p><<EndIf>></p>
<p><<End>></p>
</tbody>
</table>
User | Count |
---|---|
17 | |
14 | |
10 | |
7 | |
4 |