• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Document Generation - Condition example with OR

Adobe Employee ,
Aug 03, 2023 Aug 03, 2023

Copy link to clipboard

Copied

A coworker just asked this so I thought I'd share. The general form of a condition in Document Generation looks like so:

 

{% conditional-section expr(state = "LA") %}

La yes

{% end-section %}

 

If you want to evaluate to true based on 2 or more possible matches, use "OR":

 

{% conditional-section expr(state = "LA" or state = "PA") %}

La or PA yes

{% end-section %}

 

As an aside, this coworker specifically was asking about checking -43- values. Now, while I believe 43 clauses should work fine, it's going to be pretty ugly in your Word template. In this scenario, I'd preprocess your data. So before you call the API, look at your data, and in your code, set some _new_ property, like "inSpecial43States" to true or false based on your logic. Then your Word document will be much cleaner (and easier to understand too).

 

TOPICS
Document Generation API

Views

110

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources