[Custom Masks] [Custom Masks] Currency mask doesn´t work with 3 decimal digits

[Custom Masks] [Custom Masks] Currency mask doesn´t work with 3 decimal digits

  
Forge Component
(26)
Published on 14 Nov by Caio Santana Magalhães
26 votes
Published on 14 Nov by Caio Santana Magalhães

Hello

 I'm using Custom Mask (Outsystems 10) with the following configuration: 

 - 5 decimal digits;

- "," as decimal separator;

. "." as group separator


When I put 340,70000 it shows 340,70000 - OK;

 340,76000 it shows 340,76000 - OK;

 340,75440 it shows 340,75440 - OK;

but, when I put 340,75400 it shows 340.754,00000 - NOK


How can I solve this?


Regards,

Sara

I got it working with no problem!

Is your input type = text?

Cheers

Hi José Lopes


Yes.

I have this:



Thank you

Sara Amorim wrote:

Hi José Lopes


Yes.

I have this:



Thank you

Is there any reason you're using MaskCurrency instead of MaskNumber? I've done it with MaskNumber :) 

EDIT - Also got it working your way! Can you please test it again? 

José Lopes wrote:

Is there any reason you're using MaskCurrency instead of MaskNumber? I've done it with MaskNumber :) 

EDIT - Also got it working your way! Can you please test it again? 

Hi José Lopes

It doesn't work, even with MaskNumber.

Could be the AdvancedOptions? I've tried Change it but with no sucess.


Thanks for your help

Sara Amorim wrote:

José Lopes wrote:

Is there any reason you're using MaskCurrency instead of MaskNumber? I've done it with MaskNumber :) 

EDIT - Also got it working your way! Can you please test it again? 

Hi José Lopes


It doesn't work, even with MaskNumber.

Could be the AdvancedOptions? I've tried Change it but with no sucess.


Thanks for your help


It's not! I've done everything like you have and it works for me..

When you say, it doesn't work, what do you mean by that? you cannot input the right number? the value saved is wrong? 

Also, check the values on DecimalSeparator and GroupSeparator site properties! (The default is the opposite of what you want - probably what's wrong).

I'll attach my test here

The widget is inside a editableTable

When I select the line I insert the number 340,754

then when the user clicks somewhere it will do the multiplication of the first two columns and I get the correct value of the operation but the currency changed:



When I debugge the action where the calc takes place, the value appears wrong in the screen before the debugge starts.

The action doesn´t change the currency value. In the end refreshs the red container.




Now, if I remove the container's refresh this is what happens:

1) I insert 340,754 and i get both values correct

2) After save the row:

So far so good

3) I select the row again:



The site properties are correct, they are used only in the mask to format the value displayed.


This happens only when I insert a value with 3 decimal digits.

Sara Amorim wrote:

The widget is inside a editableTable

When I select the line I insert the number 340,754

then when the user clicks somewhere it will do the multiplication of the first two columns and I get the correct value of the operation but the currency changed:



When I debugge the action where the calc takes place, the value appears wrong in the screen before the debugge starts.

The action doesn´t change the currency value. In the end refreshs the red container.




Now, if I remove the container's refresh this is what happens:

1) I insert 340,754 and i get both values correct

2) After save the row:

So far so good

3) I select the row again:



The site properties are correct, they are used only in the mask to format the value displayed.


This happens only when I insert a value with 3 decimal digits.

Is it ok for you to post the oml? are you assigning or making any conversion to List.Current.redValue when saving?

what is the variable type associated to red input? not input type, variable? Should be Text, and when saving, you use TextToDecimal()

I've done something similiar to yours, hope it helps (attached)

Solution

Sara Amorim wrote:

The widget is inside a editableTable

When I select the line I insert the number 340,754

then when the user clicks somewhere it will do the multiplication of the first two columns and I get the correct value of the operation but the currency changed:



When I debugge the action where the calc takes place, the value appears wrong in the screen before the debugge starts.

The action doesn´t change the currency value. In the end refreshs the red container.




Now, if I remove the container's refresh this is what happens:

1) I insert 340,754 and i get both values correct

2) After save the row:

So far so good

3) I select the row again:



The site properties are correct, they are used only in the mask to format the value displayed.


This happens only when I insert a value with 3 decimal digits.

Hey Sara,


This happened to me as well. I've figured out a way to fix it, didn't alert the developers yet.

I've used the onBeforeMask callback (complete function attached).


onBeforeMask: function (value) {
                return value = value.replace(".", maskOpts.radixPoint);
            }


Best regards,

Márcio Lima.


Solution

Well, I have it working on an editable table too!

Have a look (attachment)

Hi Sara and Mário,

Can you share an .oml that has the error you are describing? You are using the latest version of the component? if not let me know which version you are using. I only have time to look into this tomorrow. when I do if I find the problem that you are talking about I will try to solve it and and publish the new version in the forge. I will let you know about my progress.

Regards,

Marcelo

Marcelo Ferreira wrote:

Hi Sara and Mário,

Can you share an .oml that has the error you are describing? You are using the latest version of the component? if not let me know which version you are using. I only have time to look into this tomorrow. when I do if I find the problem that you are talking about I will try to solve it and and publish the new version in the forge. I will let you know about my progress.

Regards,

Marcelo


Hi Marcelo,


Where can I get the version?


Regards,

Sara

Hi Marcelo Ferreira,


So, I installed the last version and itdidn´t work.

Then, in the Demo Page of CustomMask,Product_Price input I did the following: 


I switched decimalSeparator with GroupSeparator



Here's the result:




Regards,

Sara


Hi again, 

I've adapted the sample to work. I'll attach here.

The mask doesn't work properly with currency values, only text.

I've also got this error before, so the problem ain't related to IDE.

What I've done: 

In GetProducts aggregate in preparation, I've added a new attribute

After that, I've changed the variable in editable table to the new calculated attribute 

Finally, on OnProductTableRowSave, I've set the price value

All works fine :)


Hi everybody

 

Problem solved.

It worked using José and Márcio solution together.

 

Thanks!

 

Regards, 

Sara