I wanted to share something that I spend a while trying to solve.
Imagine you have 2 input fields with underlying variables - variable1 and variable2. Both variables are of type number. After pressing a button, both variables should be added to a new variable “result”.
In the logic underlying the button you would use the following formula to be assigned “result”:
Formula editor shows you as expected that 1 + 1 will give you result of 2.
When you fire up the app and test it, you will get 11 instead. Somehow number variable is not treated as number variable. To fix this you need to do explicit type conversion like this:
Above formula will give you correct result of 2.
I believe this should be a bug @Harri_Sarsa ? or is it similar to https://tracker.appgyver.com/bug-reports/p/incorrect-textinput-binding-to-number-variable ?
Thanks for sharing your solution!
Yes, the bug is exactly what you pasted there. There should be:
- explicit way to declare that I want whatever is written into this input field to be treated as a number
- by default, automatic inference of the bound value type, so that if I bind a Number type value, my input is treated as a number.
This should be acheived with a dropdown for “Input field type”, that has options
- Inferred from Value field binding type (default selection)
- Always text
- Always number
Hoping to get to this (among all the other things ) soon!
This hack no longer works. All I want to do is add two user input numbers together and there doesn’t seem to be any way to do it because of this glitch. I’ve set every possible parameter to ‘number’ where applicable and nothing works, not even the NUMBER(variable) method.
Do you have any intention of fixing the issue by chance? I rather thought I had found a program that would let me make the calculations I need, but perchance I need to keep looking?
Thank you kindly. I do hope that one way or another Appgyver succeeds in the long run!
I’m facing the same problem, every sum from input fields becomes a concatenated string, but it’s working to the others operations (-,*,/), it’s really confusing, even after allowing only numbers to the field I must use NUMBER in every variable before summing instead only +, it’s really annoying, or I can do this to cast them as a number:
variableA*1 + variableB*1
variableA/1 + variableB/1
Just to share - I hit the same problem with dropdown fields which are bound to “option lists”. Although the selected values can be saved in data resource properties defined as number, values subsequently retrieved from these properties seem to be treated as texts in formula operations. I managed to resolve the issue by using NUMBER to convert them to number first before applying mathematical operations.
Hope this helps.
Any help with this topic @Mevi , it would be very appreciated !!
NUMBER should still be working, are you having problems with it?
I spent hours looking for this. Thank you.
The SUM_BY_KEY function are with problem too?
Thanks for sharing this tip! I have spent hours trying to track down where my calculation was breaking and this fixed it. Thank you!