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

Do conditional-section's have a contains function for strings?

New Here ,
Sep 12, 2023 Sep 12, 2023

Copy link to clipboard

Copied

I am trying to use a 'conditional-section' within my document template to check if  a string contains a certain substring. Take the example shown below:

 

Assume my JSON input looks like this:

 

"House" : {
        "Furniture" : "Bed, Couch, Dresser"
}
 
And in my document template I am hoping to acheive something like this:
 

{% conditional-section expr(House.furniture contains “Couch”) %}

                The house contains a couch!

{% end-section %}

 

Is this possible? The docs linked below make no mention of such functionality. 

Template Tags | Document Generation API | Adobe PDF Services

TOPICS
Document Generation API , Feature request , How to

Views

235

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

correct answers 1 Correct answer

Adobe Employee , Sep 13, 2023 Sep 13, 2023

Document generation tags are jsonata compliant. And jsonata does support a contains function. You can find more details here https://docs.jsonata.org/string-functions . So in your case you can give the expression inside condition as $contains(House.Furniture,"Couch")

Votes

Translate

Translate
Adobe Employee ,
Sep 13, 2023 Sep 13, 2023

Copy link to clipboard

Copied

LATEST

Document generation tags are jsonata compliant. And jsonata does support a contains function. You can find more details here https://docs.jsonata.org/string-functions . So in your case you can give the expression inside condition as $contains(House.Furniture,"Couch")

Votes

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
Resources