cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

"If" type formula

dan-lowry
Deputy Chef I
Deputy Chef I

Hello all!


Is there a way to create a formula that uses .present? on a string and then inserts one of two options into the field? Seems like there is a way to do it, but I'm having issues with the syntax. The specific use case is as follows:

[datapill1].present?

{"true": [datapill1].gsub(_([datapill1]).split(';').first()+"; ","")}

{"false": nil}

6 REPLIES 6

georgiaria
Deputy Chef I
Deputy Chef I

The "ifCondition ? resultIfTrue : resultIfFalse" syntax is called a ternary expression in case that helps your research/understanding. ๐Ÿ™‚

glen-nicholas1
Workato employee
Workato employee

You can write it in english too:


if [pill].present?

"resultifTrue"

else

"resultifFalse"

end


I find it helpful to have it be descriptive if I'm sharing the recipes with other teams.