โ06-10-2021 05:12 PM
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}
โ06-10-2021 07:57 PM
The "ifCondition ? resultIfTrue : resultIfFalse" syntax is called a ternary expression in case that helps your research/understanding. ๐
โ06-10-2021 08:11 PM
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.