Change value Expression does not allow subtraction or concatenation
I have the following: Variable $a, containing "ABCDEF" Variable $b, initially containing "Hello" I want to add a Change Variable to set $b to become $b + substring($a, length($a)*random(), 1) to append a char from $a selected at random. I get "No Matching Options" from the Expression builder in the Web Modeller 2.0.232 I also have the same issue when I have an integer variable $d and I attempt to use Expression to decrement it to become: $d - 1 Please advise what I am doing wrong, as I can't find any resources explaining this issue !
$b + substring($a, round(length($a)*random()), 1)
I would suggest using a floor instead of round. The function random generates a random number in the interval [0.0,1.0). If you use round(length($a)*random()) that means that sometimes the result will be the length of the string which will throw an IndexOutOfBoundsException. If instead you have floor(length($a)*random()) you ensure that the result will be between 0 and length($a)-1. For more details see - https://docs.mendix.com/refguide4/mathematical-function-calls#floor
Writing in the Desktop Modeler does not exhibit this issue. The Web Modeler appears to have different and more limiting behaviour than the Desktop Modeler.