Most likely it's not related to math operation itself, but to how Data Binding saves values, because the only way I could achieve adding +1 is by editing this API action in Code View and correcting expression.
In additional to that: When I have numeric value in Post and trying to add + 1 to this value in Database action - it's concatenates instead of addition.
I think this problem has been around for a while - surprisingly. An alternative to editing the code manually is to create a variable with a value of 1 and use that in the expression. I think this works correctly. Iām sometimes concerned that manual fixes, made by editing the code, might be overwritten when saving the file.
When Iām trying to do some manipulation with value that comes in POST in Database Query - it becomes even weirder - it creates additional post value.
This looks like a bug - but a different issue. I donāt suppose this one would cause any problem and you can of course delete the unwanted POST variables.
The solution is to be sure the two items you are adding are considered to be numbers. Values read from the database and post variables come through as text and need to be converted with .toNumber() before you can do the maths. When one is still a text type then you get concatenation!
And yes, I find sometimes you need to create a variable with Set Value called āoneā which is of type number and has been assigned the value of 1 to make things workā¦
You make a good point about checking that the values are considered numbers, and this will certainly be the solution in many cases. However, I donāt think itās a solution in this case; as you mention, itās sometimes necessary to create a āoneā variable - but this is only to get round a (rather serious) bug.
The problem seems to be that if you enter a simple expression (1), it will not be saved as entered. Itās not very clear from the value as displayed (2), but the problem can be confirmed by clicking the pencil icon for example (3). The result in the browser (4) show the concatenated result. It also shows the variable in the expression is a number (blue, no quotes) and the result is a string (green, in quotes).
It stems from the complication that + is both addition and concatenation⦠and that Wappler sees both 1 and ā1ā as text, which therefore should be concatenated!