Hi, is there a way to not show empty columns when generating PDF through workflow? E.g. I have around 20 columns and users only fill up 10. Is there a way to hide the unfilled columns as the PDF will show a lot of blank pages when PDF is generated.
Yes you can do that with a combination of If & EndIf expression. Check this article…
Thanks for the tip! Will try it out.
Hi Aleksi, I have recently tried the <if:> and <> unfortunately it’s not working. I have tested this code <<If: ISNOTBLANK([Accommodation Drawing 11])>><<[Accommodation Drawing 11]>><> the table row still appear even though the content is blank. Appreciate if you could advice if I’m missing anything. Would like to highlight that I’m doing it by table row to show the data.
I can investigate if you provide:
- Your account id
- The app name
- The rule name
- The exact steps to reproduce the problem
@Phil Isn’t this the same user case we discussed yesterday? When you use the expression If: EndIf in a table row and the evaluation is false, it won’t delete that row from that table.
You are probably right Aleksi. I am unclear about what her template looks like and what she is trying to achieve.
Here is a brief explanation of how << If >> expressions are intended to work.
Given the following template:
<<If: ISNOTBLANK([Drawing 1])>><<[Drawing 1]>><< EndIf >>
<<If: ISNOTBLANK([Drawing 2])>><<[Drawing 2]>><< EndIf >>
<<If: ISNOTBLANK([Drawing 3])>><<[Drawing 3]>><< EndIf >>
<< End >>
For each record returned by the Start expression, the template will list the drawings that are not blank. For example, if “Drawing 1” is present and “Drawing 2” and “Drawing 3” are blank, then only “Drawing 1” is displayed, along with the blank line following “Drawing 3”.
If all three drawings are blank, you will still get the blank line at the end of the template.
If you only want to list a row if at least one drawing is present, you should exclude any rows with no drawings in the Start expression.
When you use << If >> expressions like the ones above, we do not have logic to detect that all three drawings are absent and that we should omit the row entirely. I am not sure doing that is even desirable. It is very complex to implement and it requires that we guess about the intent of the template creator. In the case above, there is simply a blank line at the bottom. You could argue that we should ignore blank lines. What should we do if the template contains other formatting elements, like thin lines between the images? Should we ignore those also? I am concerned that adding a bunch of inference rules about what parts of the template to ignore will make the feature too hard to understand.
The Start expression already provides a way to control which rows are listed. The Start expression can refer to a Slice. Slices provide a good place to specify and test the row inclusion expression. That seems like the best way include or exclude entire rows from the result.
Thank you so much for your assistance. To summarize, the app I’m trying to create is a investigation app for vessel. Each time when someone goes to a vessel they will need to take photos and report state the conditions of these things. The report can generate 6 different reports base on location of the vessel.
- POSH reporting Beta 1.4
- On Change in Accommodation
- I have roughly around 50 columns in the word file and it consist Drawing and Text in each column. E.g Drawing 1, comment 1, Drawing 2, comment 2, and so forth. If users only fill up until 20 pictures, they will see extra blank pages after the PDF is generated
A template like the following worked for me:
Accommodation Key: <<[Key] >>
Vessel Name: <<[Vessel Name] >>
Date Report: <<[Date Report] >>
<< If: OR(ISNOTBLANK([Accommodation 1]), ISNOTBLANK([Accommodation Drawing 1])) >>
Accommodation 1: <<[Accommodation 1]>>
Accommodation Drawing 1: <<[Accommodation Drawing 1]>>
<< EndIf >>
<< If: OR(ISNOTBLANK([Accommodation 2]), ISNOTBLANK([Accommodation Drawing 2])) >>
Accommodation 2: <<[Accommodation 2]>>
Accommodation Drawing 2: <<[Accommodation Drawing 2]>>
<< EndIf >>
<< If: OR(ISNOTBLANK([Accommodation 3]), ISNOTBLANK([Accommodation Drawing 3])) >>
Accommodation 3: <<[Accommodation 3]>>
Accommodation Drawing 3: <<[Accommodation Drawing 3]>>
<< EndIf >>
<< If: OR(ISNOTBLANK([Accommodation 4]), ISNOTBLANK([Accommodation Drawing 4]))>>
Accommodation 4: <<[Accommodation 4]>>
Accommodation Drawing 4: <<[Accommodation Drawing 4]>>
<< EndIf >>
<< If: OR(ISNOTBLANK([Accommodation 5]), ISNOTBLANK([Accommodation Drawing 5])) >>
Accommodation 5: <<[Accommodation 5]>>
Accommodation Drawing 5: <<[Accommodation Drawing 5] >>
<< EndIf >>
Although this template works, my recommendation would be to change the way the Accommodation drawing information is stored.
Having a repeating field with from zero to fifty occurrences is seldom the best approach for storing repeating data.
This is especially true, when the number of instances varies and can be large.
It would be better to create a new child table to hold the Accommodation data.
Each row in the table would contain one drawing.
The child table would contain:
- A key Text field with the InitialValue of UNIQUEID()
- A Ref field that refers to the parent table
- An “Accommodation” Text field.
- A “Drawing” Drawing field.
Your template would then include a Start expression that used the Reverse Ref in the parent record to list each of the child table records.
Thanks so much for the advice. I tried to create a child table before but I was having problem generating reports just for Accommodation report from the parent table. The report only generated 1 Accommodation text field and Drawing field. I will try out again, I may have left out adding expressions in it and that might the reason why it was not working.
Once again thank you so much for taking your time to explain all these details to me. Really appreciate it. Cheers!
I think you will find that the child table will make your life easier.
Do the following:
- Add the child table to hold the photos, as I described above.
- Create the workflow attachment or body template for the parent record by clicking the “Create” button. AppSheet should automatically generate a template that will list the parent and child records. It knows to include the child records in the generated template because the parent record contains a system generated Reverse Ref field to the child records. The generated template will contain a Start expression that retrieves the child records using the Reverse Ref field.
- You my want to modify the generated template to improve its appearance.
If you have trouble with the template, let me know, and I can help you.