Hello people, good day. Does anyone know how to remove zeros to the right of the decimal point? Imagine that once I have a quantity of 10.3, but another time I have a quantity of 0.005.
If I show a number of zeros to the right of the comma it can lead to misinterpretation. For example, if the first quantity is 10.3, it will be displayed as 10,300 and that lends itself to understanding that the number can be ten thousand three hundred when it is 10.3
I would like zeros not to appear if they do not provide a value at the end of the result, but I would like them to be taken into account since in many cases they are necessary.
Solved! Go to Solution.
Probably, this expression (for new VC, anchoring your decimal column with 3 digits max) will solve the issue.
ifs(
endswith(text([Decimals]),"000"),left(text([Decimals]),len(text([Decimals]))-3),
endswith(text([Decimals]),"00"),left(text([Decimals]),len(text([Decimals]))-2),
endswith(text([Decimals]),"0"),left(text([Decimals]),len(text([Decimals]))-1),
true,[Decimals]
)
[Decimals] column is normal column, set to decimal type with max 3 digits.
Show this column with context(viewtype)=Form.
LEN(TEXT([number] - FLOOR([number]))) - 2
But I'm not sure whether AppSheet takes into account more than two decimal digits anyway.
Hello @Gustavo_Eduardo , you could try using the TEXT() function, apparently it can help by using both "," and "." for displaying your numbers, here's the example it shows in the help page:
Hi @Rafael_ANEIC-PY I'm going to try as you say, with a text function, but I'm going to suggest to appsheet the possibility of adding a feature where it can be checked ("omit trailing zeros")
Muchas gracias Rafael. Por ahora tome la soluciรณn de Koichi
What do you want to do with the case of 10/3, result would be 3.33333333333333.......?
Hello, how are you @Koichi_Tsuji? In general, in the configuration of the field you choose how many decimal places the value written there will have. I would like to have three decimal places to the right of the decimal point; however, there are cases where you would prefer not to have three decimal places. These cases are those in which only zeros appear to the right of the decimal. I have NEVER divided 10/3 but I am writing a decimal 10.3 (103/10) What I want is that I don't get the zeros on the right
Probably, this expression (for new VC, anchoring your decimal column with 3 digits max) will solve the issue.
ifs(
endswith(text([Decimals]),"000"),left(text([Decimals]),len(text([Decimals]))-3),
endswith(text([Decimals]),"00"),left(text([Decimals]),len(text([Decimals]))-2),
endswith(text([Decimals]),"0"),left(text([Decimals]),len(text([Decimals]))-1),
true,[Decimals]
)
[Decimals] column is normal column, set to decimal type with max 3 digits.
Show this column with context(viewtype)=Form.
So you mean max 3 decimals, or less?
Sure. What I ask is how to remove zeros to the right of the decimal point if they are not useful?
Reciรฉn lo veo @Koichi_Tsuji , me lo hizo notar @Joseph_Seddik agradezco su soluciรณn! Un saludo!! Pienso que con 3 decimales como mรกximo estรก perfecto
You already have the solution. Please use the expression Koichi provided.
Gracias Joseph por hacermelo notar, ahรญ la aplicarรฉ.
IF(
(([Decimal] - FLOOR([Decimal])) = 0.0),
TEXT(FLOOR([Decimal])),
TEXT([Decimal])
)
Thanks you Steve!!!
Staying on topic, guys. Does anyone know a formula to count the decimal places that a number has?
LEN(TEXT([number] - FLOOR([number]))) - 2
But I'm not sure whether AppSheet takes into account more than two decimal digits anyway.
Gracias Joseph! si funciona perfecto, de paso te comento que si tiene en cuenta el resto de decimales porque el resultado es 3 y yo tengo 3 decimales! un abrazo
Perfecto, gracias por la informaciรณn ๐
User | Count |
---|---|
25 | |
24 | |
24 | |
23 | |
16 |