[Input Masks Mobile] Incorrect value when decimal has no decimal part

[Input Masks Mobile] Incorrect value when decimal has no decimal part

  
Forge Component
(8)
Published on 2017-11-15 by Labs
8 votes
Published on 2017-11-15 by Labs

Hello.

When using the currency mask on an edit screen, if the value got from the fetched data is for instance 123.45, it binds the value correctly:

If the value is for instance 1500.00, the mask doesn't work correctly  and shows to the user the value 15.00:

Can you guys give us help on fixing this (multiplying by 100 is not an option)?

Thank you!


Cheers,

Gonçalo M.

Also, another scenario that doesn't work is for instance 1000.50 since appears 1000.50:


Cheers,

GM

Hi Gonçalo,

I've been testing this component and checking what you are explaining and here's my thoughts.

Following your 1000.50 example, the problem is that the value is stored in the database as 1000.5, no matter if its data type is Currency or Decimal. So when the Currency mask gets the value, it assumes that the 2 last digits are the decimal part, which becomes 100.05.

You can overcome this issue in 2 different ways: 

  • If you store the value as Text, you won't have this issue, since it will be stored as "1000.50". You just have to convert it to decimal whenever you need to use it as a decimal.
  • After fetching the (Currency or Decimal) data from the database, which returns 1000.5, use the FormatDecimal() built-in function. Example: FormatDecimal(your_currency_value, 2, ".", "") will return you a text with the value "1000.50".

Let me know if this helps.


Best regards,

André

Hi André.

That was actually the workaround we used but on my perspective, this is a very common use case that the component should address.

Thank you.


Best Regards,

Gonçalo Martins

Hello,


I am also stuck with this issue. And as stated by Gonçalo, this is a very common use case, the component should not generate such a basic issue. It would be nice to have some update soon or at least a better workaround.


Thank you,

Tomás Silva