Skip to main content
Participant
Sep 13, 2023 4:02 AM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
Dheeraj5FACCorrect answer
Adobe Employee
Sep 13, 2023 2:39 PM UTC

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
Sep 13, 2023 2:39 PM UTC

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

Translate