59
Views
7
Comments
Decimal Value Should not RoundOff
Application Type
Traditional Web

Hi All,


I want to display the exact decimal number but when i use this formula

FormatDecimal(TextToDecimal(TextVar),2,",",".") it roundoffs the value which i enter.

how can i achieve the exact value?

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi Shashank,

round off to what, can you show an example ?

i'd expect your expression to round off to 2 decimals, is that not what happens ?

a possible reason for confusion i could see, is that your textvar is using a ',' as decimal separator, the TextToDecimal expects a '.'

But more important question, if your data is of type decimal, why do you store it in a TextVar at any point.

Dorine

UserImage.jpg
Shashank Bharadwaj

Hi Dorine,

Sorry was using this formulae

FormatDecimal(TextToDecimal(text), 2, ".", ",") +"%"


For example i need 19.25 but it returns 19.00%

another example 21.50 it returns 21.00%

2021-09-06 15-09-53
Dorine Boudry
 
MVP

yes,

but i need to know what is coming in, for starters, what is datatype of 'text' variable, and what is the exact text value of your number

UserImage.jpg
Shashank Bharadwaj

Have given in the example right

If the value of text is 19.25 it should be 19.25 but it is rounding to 19.00 only.

As mentioned by you for the text variable i pass 19.25

2021-09-06 15-09-53
Dorine Boudry
 
MVP

the reason i ask further is because i can not replicate this problem, can you share an oml demonstrating it ?

2021-09-06 15-09-53
Dorine Boudry
 
MVP


I see this when testing, but that's reactive.

UserImage.jpg
Shashank Bharadwaj

I found out how i can do otherway.

the other way is texttodecimal() or intergertodecimal().

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.