Resolving Null variables

In our system a user can enter up to 3 studies but only one is required. 
My current work around is saving any studies not entered to "N/A"

if(
isnull(ri!svcRequest.study_two),
{ a!save(ri!svcRequest.study_two, "N/A") },
{}
),
if(
isnull(ri!svcRequest.study_three),
{ a!save(ri!svcRequest.study_three, "N/A ") },
{}
),

Issues is In the follow up email it looks like this: 

We were pleased to support your review by performing additional analysis on studies: cat, N/A, N/A

How do I show and hide variables with null values so the sentence above only shows studies that are entered? 

We were pleased to support your review by performing additional analysis on studies: cat 

Side note: this is what the email expression looks like: 

=pv!svcRequest.study_one & ", " & pv!svcRequest.study_two & ", " & pv!svcRequest.study_three

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You would just wrap each one of the subsequent entries in its own if() statement, it doesn't really require nesting per se.  This would allow you to use either or both of "study_two" and "study_three", and inherently requires "study_one" to be filled in.

    pv!svcRequest.study_one &
    if(
      a!isNullOrEmpty(pv!svcRequest.study_two),
      null(),
      ", " & pv!svcRequest.study_two
    ) &
    if(
      a!isNullOrEmpty(pv!svcRequest.study_three),
      null(),
      ", " & pv!svcRequest.study_three
    )

Reply
  • 0
    Certified Lead Developer

    You would just wrap each one of the subsequent entries in its own if() statement, it doesn't really require nesting per se.  This would allow you to use either or both of "study_two" and "study_three", and inherently requires "study_one" to be filled in.

    pv!svcRequest.study_one &
    if(
      a!isNullOrEmpty(pv!svcRequest.study_two),
      null(),
      ", " & pv!svcRequest.study_two
    ) &
    if(
      a!isNullOrEmpty(pv!svcRequest.study_three),
      null(),
      ", " & pv!svcRequest.study_three
    )

Children