There are sometimes situations where you’d like to show or hide sections of your data template based on the outcome of each Form entry’s answers.
For example, you may have an optional section in your Form that is not displayed or filled out depending on what the app user fills out.
The associated data template will likely have the same requirement – i.e. you don’t want to show a section of the template when it is not needed.
Our platform enables you to dynamically hide rows or whole sections of your template using the syntax outlined below.
Dynamically Hiding Sections in Templates
To hide a section of your Word or Excel template, use the special !HIDEIFSTART placeholder:
{{!HIDEIFSTART( put a formula that evaluates to True/False here )}}
{{!HIDEIFEND}}
So for example:
{{!HIDEIFSTART( {{myoption}} = ‘No’ )}}
This is some content that will be hidden…
… and some more to be hidden.
{{!HIDEIFEND}}
will hide the content between the START and END placeholders if the myoption answer is No.
NOTE:
In Word templates, you must ensure there is either a space or a new line between the !HIDEIFSTART, HIDEIFEND and what needs to be hidden.
e.g.
{{!HIDEIFSTART( {{myoption}} = ‘No’ )}} Content to be hidden {{!HIDEIFEND}}
In Excel, or tables in a Word document, the !HIDEIFSTART, HIDEIFEND and content to be hidden must be in separate cells, i.e. not all in the same cell.
e.g.
{{!HIDEIFSTART( {{myoption}} = ‘No’ )}} |
Content to be hidden |
{{!HIDEIFEND}} |
Dynamically Hiding Rows in Templates
Dynamically Hiding Rows in Templates
If you have rows that should only be shown when a specific answer value is given, you’re in luck š
Use the special !HIDEROWIF placeholder to dynamically show/hide a given row:
{{!HIDEROWIF( put a formula that evaluates to True/False here )}}
For example:
{{!HIDEROWIF( string-length({{chosenproduct}}) = 0 )}}
which will hide the row if the chosen product answer is empty or not set.
This kind of formula is handy if you only want to show output if an answer is given.
In Word, you must ensure there is either a space or a new line between the !HIDEROWIF and what needs to be hidden.
e.g.
{{!HIDEROWIF( {{selectedanswer}} = ‘Y’ )}} Content to be hidden
Also, ensure the !HIDEROWIF and content to be hidden in tables is in separate cells, i.e. not all in the same cell.
e.g.
{{!HIDEROWIF( {{selectedanswer}} = ‘Y’ )}} |
Content to be hidden |
Note that you can also use the !HIDEROWIF placeholder inside a !REPEATSTART section on Excel.
In Word templates, HIDEROWIF is always evaluated first before any REPEAT syntax is run.
For example in Excel, the row inside the REPEATSTART / END will be repeated, and selectively hidden based on the selectedanswer value:
{{!REPEATSTART}}
{{!HIDEROWIF( {{selectedanswer}} = ‘Y’ )}}
{{!REPEATEND}}
Common Error
Expression matching between the round closing bracket of the IF condition and the closing double braces is space sensitive.
If there is a space between them, this will cause the expression matching to fail. The HIDEIF statement won’t be recognised and will be skipped.
e.g.
fail
{{!HIDEIFSTART( {{myoption}} = ‘No’ ) }}
pass
{{!HIDEIFSTART( {{myoption}} = ‘No’ )}}