if() function

Could someone explain why the following code work without compiler errors?

if(
    isnull(ri!user),
    "",
    isusernametaken(ri!user),
    user(ri!user, "firstName") & " " & user(ri!user, "lastName"),
    joinarray(split(ri!user, "."), " ")
)

I expect some kind of evaluation error, but it works just as the three lines starting on "isusernametaken" were an embedded if.

I saw that in one of the Appian courses and I'm wondering if it is some undocumented feature of the if function.

Thank you

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    if() has hidden else if functionality in it.  What's documented is:

    if(

    condition

    return if true,

    return if false

    )

    What you can do with it:

    if(

    condition1,

    return if condition1 true

    condition2 if condition1 false {else if}

    return if condition2 true

    return if condition2 false

    )

    Or you can do it with 7, 9, 11, 13.  Every odd input is another conditional until the very last one, what returns if they're ALL false.

    It's way less keypresses, but gets dramatically unreadable.

Reply
  • +1
    Certified Lead Developer

    if() has hidden else if functionality in it.  What's documented is:

    if(

    condition

    return if true,

    return if false

    )

    What you can do with it:

    if(

    condition1,

    return if condition1 true

    condition2 if condition1 false {else if}

    return if condition2 true

    return if condition2 false

    )

    Or you can do it with 7, 9, 11, 13.  Every odd input is another conditional until the very last one, what returns if they're ALL false.

    It's way less keypresses, but gets dramatically unreadable.

Children