I saw such a example code in APPIAN DEVELOPER course practice document. (Expressions: Transform Your Data, Build an Application: Step 4)
I couldn't understand why if() coukd take arguments more than 3. The usage of if() should be "if(condition, valueIfTrue, valueIfFalse)" according to official doc.
proper( if( isnull(ri!user), "", isusernametaken(ri!user), user(ri!user, "firstName") & " " & user(ri!user, "lastName"), joinarray(split(ri!user, "."), " ") ) )
Discussion posts and replies are publicly visible
Hi don't have the answer to "Why" but I do have one for "How" The total number of arguments should be odd, more than 3. Every even argument acts as a statement and every odd arguments act as a condition. The last statement will act as a false statement for the third last argument.
Thank for your immidiate reply, Harshit!
You mean if() which has 5 arguments in Appian can be equal to such statements in Ruby.
if expression1 then value1 elsif expression2 then value2 else value3 end
Maybe I understand that, but it is strange that this basic information is not mentioned at all in the official document.
docs.appian.com/.../fnc_logical_if.html
While this technically works, I consider this to not be a best practice. I am going to contact Appian to only use officially supported functionality in the courses.