4 Replies Latest reply on Jul 18, 2017 9:51 AM by philmodjunk

    Possible to have conditional within a calculation?




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