โ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 05:16 PM
[datapill1].present? ? ([datapill1].gsub(_([datapill1]).split(';').first()+"; ","")) : null
Sometimes I want the result to be an empty string instead of nil - in that case, I do this:
[[datapill1],''].compact[0]
โ06-10-2021 05:18 PM
you can use something like this
โ06-10-2021 05:37 PM
=_('data.logger.3dcdc175.message').present?? (_('data.logger.3dcdc175.message').gsub("dr","").split(";").first() + "; " + "") : nil
โ06-10-2021 05:42 PM
Thanks for all the responses! I knew I was missing something and that second ? fixed it.