Skip to main content
Participant
September 13, 2023
Answered

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

  • September 13, 2023
  • 1 reply
  • 374 views

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

This topic has been closed for replies.
Correct answer Dheeraj5FAC

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")

1 reply

Dheeraj5FACCorrect answer
Adobe Employee
September 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")