Assuming $TimeLeft is a variable of the same type as TimeLeft attribute of entity Time
if $TimeLeft > 0 then
$Time/TimeLeft – 1
else
$TimeLeft
Hello,
Take a look at: https://docs.mendix.com/refguide/if-expressions for the documentation
For your specific case:
if TimeLeft > 0
then TimeLeft=Time/TimeLeft – 1
else
TimeLeft = TimeLeft
if $Time/TimeLeft > 0
then
$Time/TimeLeft - 1
else
$Time/TimeLeft
Yes, you can use it in the Change Object action.
You’ll need something like this
if ($Time/TimeLeft > 0) then
$Time/TimeLeft – 1
Like this:
Regards,
Ronald
In addition to those answers, it’s recommended to check first if TimeLeft is not empty. If it’s empty you will get an error.
if $Time/TimeLeft != empty and $Time/TimeLeft > 0 then
$Time/TimeLeft - 1
else
0