AnsweredAssumed Answered

Possible to have conditional within a calculation?

Question asked by lokinyc on Jul 18, 2017
Latest reply on Jul 18, 2017 by philmodjunk

Hi

 

I feel like this is possible but don't have the FM experience to know for sure. I'm assembling a text string from a set of field values, and want to add a comma between two values ONLY if the final value is not empty. So:

 

FIELD A     FIELD B

 

=>

 

"FIELD A, FIELD B"

 

but if FIELD B is empty, I want to have just

 

"FIELD A"

 

I can easily do it in two script steps - set my result as FIELD A, then test for FIELD B and add a comma followed by field value if not empty, but can I do something like this to get it into a single script step?

 

$var = Value (FIELD A) & (IF (FIELD B): ", " & FIELD B; "")

 

(probably don't even need the semi-colon and final "", but you get the idea).

 

thanks!

Matt

Outcomes