You can use the ternary operator:
io87 ? first : second
Thank you, it works. How come this expression truncates my decimals?
io83 ?? io83/10.0F
Instead by leaving only io83/10.0F the final result correctly has one decimal place.
The output is always of type number
Are you sure the result is truncated? Or the UI just displays one decimal place? Check the API or the database.
These are the two tests done directly from the attributes page
Oh I see. Your expression doesn't really make sense. It always uses the original value.
I would basically need the attribute to be calculated only if io83 exists. Are there any other solutions?
In that case your expression is completely incorrect. The right solution would be something like this:
io83 ? io83/10.0F : null
thanks it work
Hello,
5.6 I saw that the old IF syntax in calculated attributes is no longer supported.
For example I had this attribute:
If(io87) { } else { return io87 }
How can this be done now? From the JEXL syntax it still seems to be allowed (https://commons.apache.org/proper/commons-jexl/reference/syntax.html)
I also have some nested ifs that I wouldn't know how to convert
Thanks!