Microflow expression for a failed parseDecimal function

Hello -  I have a microflow that converts a string to a decimal (parseDecimal) and stores that new value in a separate decimal attribute. I'm doing this using a $variable, and I would like to return a message if the $variable doesn't contain something that can convert - so "1.5" would convert, but "text" would not, for example. Anyone know how to write this expression in Mendix? Thanks, Mark
1 answers

Hi Mark,

You can provide a default value for when the parse fails:

parseDecimal('3.45') returns 3.45
parseDecimal('text', 5.05) returns 5.05
parseDecimal('text', empty) returns empty

More about parseDecimal:  https://docs.mendix.com/refguide/parse-and-format-decimal-function-calls

Hope this helps.

Cheers, Jeffrey