Skip to main content
Raymond Camden
Community Manager
Community Manager
January 9, 2024
Question

Tip for Conditionals with Arrays and Document Generation

  • January 9, 2024
  • 0 replies
  • 254 views

Imagine you're working with an array of data that can be 0 to 3 values, based on some user input. Now imagine you want to conditionally show a paragraph of text based on if a value exists in that array. 

 

To do that in your Word template, use the `in` keyword. Here's an example:

 

{% conditional-section expr(“ray” in names) %}

 

Given that names is an array of strings, if 'ray' exists as an item, the text inside the condition will be displayed.

This topic has been closed for replies.