The virtual column is decimal type having 4 decimal digits.
given result is
The expected result is 0.5000.
Why?
The virtual column is decimal type having 4 decimal digits.
given result is
The expected result is 0.5000.
Why?
Please try
1/2.0000 as app formula.
Thanks but regret to say that it does not answer my question.
Division with integers ( 1/ 2) , will have integer result. (0)
Dividing by 2.0000 brings in decimal division. Number of decimal points in denominator will give decimal points in answer. Division by 2.0 will result in 0.5
Read the document I refered to .
Thank you very much.
Thanks Steve. If an expression contains [columns], the result seems ok. In my case there was pure numbers with operators, adjusting the decimal points of virtual column does not help showing the expected value.
Anyway that was just my experiment, there is no use in real apps.
What does this have to do with anything?
All this started from my curious of how AppSheet prioritizes the math operators in calculations (I have not seen any documentations mention about it).
To check if 1-1/2 returns 0.5 (like scientific calculators) or 0 ? I created a virtual column to test it. The result was 0. But I could not conclude that the result 0 was from calculation or from displaying behavior.
If AppSheet does scientific way, I will not use extra ( ) in my expressions.
AppSheet applies common math order of operations, but order of operations is not the problem with your expression.
To make things clear, what are the results from this following expressions in AppSheet?
[column a]-[column b]/2 =?
[column a]-([column b]/2) =?
([column a]-[column b])/2 =?
If the values of [column a] and [column b] are 1.
What are the column types of column a and column b?
Absolutely decimal type.
Then I would expect:
[column a]-[column b]/2
to give 0.5
[column a]-([column b]/2)
to give 0.5
([column a]-[column b])/2
to give 0
But if they are instead of type Number:
[column a]-[column b]/2
would give 1
[column a]-([column b]/2)
would give 1
([column a]-[column b])/2
would give 0
Thank you