206
Views
3
Comments
Solved
Format currency for value inside input widget (CRUD - all operations)
Application Type
Reactive
Service Studio Version
11.53.11 (Build 61107)
Platform Version
11.17.0 (Build 36616)

Someone can help me with a question?

I need an input that displays values in Real currency (R$), exactly in this format: R$ 1.000,00.

I've already tested some Forge components and none of them works fully. Some of them work on inclusion but don't work on change, or vice versa.

It's unbelievable that OutSystems has so many amazing features, but doesn't provide standard input formatting.

Grateful

Observation: I have already tested the components below which have a lot of votes in Forge:
* InputMaskReact
* InputMasks

mask.JPG
2021-10-23 05-44-15
José Marcelo da Silveira
Solution

I solved the problem using this component:

https://www.outsystems.com/forge/component-overview/7798/mask-br-react

First I need to get the value of my aggregate and convert it to text to be used by MoneyMask, so that the symbol [R$] can be displayed in the Input and with the currency format of Brazil.

Then, before saving, I need to remove the [R$] symbol and the dots from the grouper. Then I change the comma to a period [.] in order to convert the text to decimal.

With that, it works perfectly, in the inclusion and also on update of the registry.

2022-03-10 08-26-10
Cristian Angel Puma Villalva

Hi Jose,

I hope I have translated your question correctly.

Look I share 2 ideas to show the currency symbol in an expression.

You could use a concatenation to add the symbol to it.



Option 2:

You can use the FormatCurrency function, even better :)

 

Now so that the symbol is in a form or an input, don't get complicated and add a label, where there is only the symbol and from the input only add the value.




I hope it helps you.
Greetings and success!


PSD: 
I need work 🐒 

2021-10-23 05-44-15
José Marcelo da Silveira

Hi Christian,

I understood your idea to separate the symbol by putting it on a label. However, the biggest problem is not even the symbol, but the format of the number, it needs to be in this format: [999.999,99], you understand?

And that I still couldn't do, because in Input it's not possible to use FormatCurrency.

But thanks for replying and trying to help me. 

2021-10-23 05-44-15
José Marcelo da Silveira
Solution

I solved the problem using this component:

https://www.outsystems.com/forge/component-overview/7798/mask-br-react

First I need to get the value of my aggregate and convert it to text to be used by MoneyMask, so that the symbol [R$] can be displayed in the Input and with the currency format of Brazil.

Then, before saving, I need to remove the [R$] symbol and the dots from the grouper. Then I change the comma to a period [.] in order to convert the text to decimal.

With that, it works perfectly, in the inclusion and also on update of the registry.

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