Hiding Content in Custom Templates

Hiding Content in Custom Templates

Sometimes, 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 selects.

The associated data template will likely have the exact requirement – i.e., you don’t want to show a section of the template when it is unnecessary.

This article covers various options for hiding content in your template output. However, nesting HIDEIF() conditions inside another is not supported. Therefore, always complete one conditional syntax block before opening a new one.

Syntax

Using the following syntax, our platform allows you to dynamically hide entire sections or table rows in your custom Word or Excel template.

{{!HIDEIFSTART( put a formula that evaluates to True/False here )}} "Content to be hidden." {{!HIDEIFEND}}

True = Content Hidden
False = Content Displays

{{!HIDEROWIFput a formula that evaluates to True/False here )}}“Row content to be hidden.”

Word Templates

In Word templates, you must ensure either a space or a new line between the !HIDEIFSTART!HIDEIFEND syntax, and what needs to be hidden.

Hiding Sections (Word)

To hide a section, use the following to hide content between the !HIDEIFSTART / !HIDEIFEND syntax if the option answer is No.

Example

{{!HIDEIFSTART( {{myoption}} = 'No' )}} This is some content that will be hidden... ...and some more to be hidden. {{!HIDEIFEND}}

Or on the same line.

{{!HIDEIFSTART( {{myoption}} = 'No' )}} Content to be hidden {{!HIDEIFEND}}

Hiding Table Cells (Word)

Demonstrating three different formulas achieving the same result. In this case, the content to be hidden is an image, but it could also be static text or form field data name placeholders.

Example

Question

Poor

Satisfactory

Good

Q1{{!HIDEIFSTART(NOT({{Q1}} = ‘Poor’))}}

{{!HIDEIFEND}}
{{!HIDEIFSTART({{Q1}} != ‘Satisfactory’)}}

{{!HIDEIFEND}}
{{!HIDEIFSTART({{Q1}} = ‘Poor’ OR {{Q1}} = ‘Satisfactory’)}}
{{!HIDEIFEND}}
Q2{{!HIDEIFSTART(NOT({{Q2}} = ‘Poor’))}}
{{!HIDEIFEND}}
{{!HIDEIFSTART({{Q2}} != ‘Satisfactory’)}}
{{!HIDEIFEND}}
{{!HIDEIFSTART({{Q2}} = ‘Poor’ OR {{Q2}} = ‘Satisfactory’)}}
{{!HIDEIFEND}}
Q3{{!HIDEIFSTART(NOT({{Q3}} = ‘Poor’))}}
{{!HIDEIFEND}}
{{!HIDEIFSTART({{Q3}} != ‘Satisfactory’)}}

{{!HIDEIFEND}}
{{!HIDEIFSTART({{Q3}} = ‘Poor’ OR {{Q3}} = ‘Satisfactory’)}}
{{!HIDEIFEND}}

Formula use can be within a single cell (as shown above) or contain multiple/stacked !HIDEIFSTART / !HIDEIFEND in a single cell.

Hiding Table Rows (Word)

Suppose you have rows that should only be shown when a specific answer value is given. Use the special !HIDEROWIF syntax to dynamically show/hide a given row.

Ensure the !HIDEROWIF and the content to be hidden are in a table and separate cells.

Example

{{!HIDEROWIF( ISBLANK({{chosenProduct}}) )}}“Row content to be hidden.”

This will hide the row if the chosen product answer is empty, not set, or blank. This formula is handy if you only want to show output if an answer is given.

Hiding Repeating Rows (Word)

In Word templates, you can also use a !HIDEROWIF inside a !REPEATSTART section.

The !HIDEROWIF is evaluated first before any REPEAT syntax is run, repeating and selectively hiding rows based on the formula result.

Example

{{!REPEATSTART}}

{{!HIDEROWIF( STRING-LENGTH({{chosenProduct}}) < 7 )}}“Row content to be hidden.”

{{!REPEATEND}}

A table row {{!HIDEROWIF(...)}} should only contain that clause and the row’s content.
Mixing HIDEROWIF with other hiding conditions or unrelated commands within the same table row is not supported and may result in unexpected behavior.
Make sure the row is dedicated solely to the HIDEROWIF logic.

Excel Templates

We use the same syntax for hiding/displaying rows in Excel as in Word, although Excel has a few differences due to its default tabular layout.

Hiding Sections (Excel)

To hide a section of your Excel template, use the !HIDEIFSTART / !HIDEIFEND syntax and the content to be hidden in separate cells.

Example

{{!HIDEIFSTART{{myoption}} = 'No' )}}
“Content to be hidden”
{{!HIDEIFEND}}

Or on the same row.

{{!HIDEIFSTART{{myoption}} = 'No' )}}“Content to be hidden.”{{!HIDEIFEND}}

Hiding Table Cells (Excel)

Unfortunately, cell-level hiding of cells is not supported in Excel. We recommend using a Word template instead for more granular control of cell visibility. 

Hiding Rows (Excel)

Suppose you have rows that should only be shown when a specific answer value is given. Use the special !HIDEROWIF syntax to dynamically show/hide a given row:

Example

{{!HIDEROWIF( ISBLANK({{chosenProduct}}) )}}“Row content to be hidden.”

This will hide the row if the chosen product answer is empty, not set, or blank. This formula is handy if you only want to show output if an answer is given.

Hiding Repeating Rows (Excel)

In Excel templates, you can also use a !HIDEROWIF inside a !REPEATSTART section.

The !HIDEROWIF is evaluated first before any REPEAT syntax is run, repeating and selectively hiding rows based on the formula result. 

Example

{{!REPEATSTART}} 
{{!HIDEROWIF( {{selectedanswer}} = 'Y' )}}“Row content to be hidden.”
{{!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 recognized and will be skipped.

{{!HIDEIFSTART( {{myoption}} = 'No' ) }}
{{!HIDEIFSTART( {{myoption}} = 'No' )}}
    • Related Articles

    • Repeatable Data in Templates

      After capturing repeatable data, you might want to customize how it displays in a PDF output using Word or Excel templates. There are two ways to output the answers for these repeatable fields in your template: Repeat rows in a Word table or Excel ...
    • Custom Templates FAQs

      Can I use Word/Excel 2003? No. We support .DOCX and .XLSX files only which means that Office 2003 formats (.doc and .xls) are not supported. Note that we also do not support Word .dotx files and .xlsm (these are special Word/Excel file types.) Can I ...
    • Word Templates

      Our platform allows you to export Data in the layouts you want using Microsoft Word templates or Excel. If you already have Word documents that you have been printing out to use as data capture Forms, you can reuse them as data templates with a few ...
    • Inject Attached PDFs in Templates

      It’s now possible to inject PDF attachments as text into Word/Excel template outputs in conjunction with field-captured data. Upload an ‘industry-standard’ A4 PDF document using our Attach Field and embed it within a custom data template. This ...
    • Task Templates

      Task Templates let you pre-set various properties of a regular task within your business process as a template that can be used when creating a new task, making the process quicker for dispatchers. Without a template, you need to set every aspect of ...