Select to view content in your preferred language

S123 Report Template | Conditionally render text if photo attachment not present

270
2
Jump to solution
09-09-2024 08:16 AM
KyleWeaver
Emerging Contributor

Hi all!

Been racking my brain and trying different approaches but still don't have the solution I'm looking for and wondering if anybody found a workaround. Basically within a S123 Word report template, I would like to conditionally render some text ("No Photos Included) in a table row when a photo attachment isn't included with that survey record. 

Since attachments are stored differently (nested table), I wasn't having any luck with the usual IF conditional statements in the report. Basically, was trying to use the count function and if equal to "0", then render the text.

In testing, I used this attribute to get the count of photos and this returns the correct result of "0".

${site_photo_1 | getValue:"count"}

But then when I expand on this to include the conditional statement, it's not working correctly. Here is what I was using:

${ if site_photo_4 | getValue:"count" == 0}, No Photos Included ${/}

I've also tried other variations like:

${ if site_photo_4 == ""}, No Photos Included ${/} and others but still can't get the text to render the text correctly.

Anybody encountered this before or have a solution that works for them? Thanks so much!

0 Kudos
1 Solution

Accepted Solutions
abureaux
MVP Frequent Contributor

if${!(site_photo_4)}No Photos Included.${/}

View solution in original post

2 Replies
abureaux
MVP Frequent Contributor

if${!(site_photo_4)}No Photos Included.${/}

KyleWeaver
Emerging Contributor

Thanks so much for the response! I just had to modify the syntax slightly to get it to work (just had to switch the variable $ sign and incorporate the "if" statement within the brackets but it worked!! Final syntax:

${if !(site_photo_4)}No Photo Included For Item Scope Number.${/}

I really appreciate it! 

Kyle

 

0 Kudos