Hi, guys!


I'm using Mask Currency (Custom Masks, Outsystems 10) with this configuration:

- "R$ " as prefix;

- "," as decimal separator;

- "." as group separator.


In this input I need to get the income value of an employee, so that I've chosen Mask Currency.

The problem is that for any value that I type in, it returns me "Integer expected!" in red.

I don't know if this is the best way to do so.

Here is a screen shot of the input mask and the answer, respectively:




All help is very welcome (:


Best Regards,

Eduardo Coelho


Hello Eduardo,

Check the type of input and variable associated configured in the input that the mask is pointing to. It is possible that it is configured as an integer when it should be text for the mask to work correctly.




James Andrade wrote:

Hello Eduardo,

Check the type of input and variable associated configured in the input that the mask is pointing to. It is possible that it is configured as an integer when it should be text for the mask to work correctly.




Hi, James!

I've checked both values.

The input type is "text" as you can se here:


But, the Entity Attribute data type is Integer:

I'm afraid I can't change this because the database was already created and I was supposed only to use it. 

Is there any other way to deal with this instead of changing the database? Something like converting data etc.


Best regards,

Eduardo Coelho 

Solution

Yes, there is a way to convert the value of the entry.
However I leave an alert, a field that will keep the salary value, it should always be decimal.

Anyway you will need to create a new variable that will serve to fill the input. And then in the action where you will save this value, then you must perform the TextToInteger()  conversion.

Input Variable:




In Save Action:
Use de action ValidateTextToInteger() to check if is an integer valid in the text.

Asign

Solution

Thank you, James!

This shouldn't be the way to solve the question, but the situation needed.

I'm aware of your alert and will talk to the other developers to see if this can be changed in the database.

Otherwise, I'm using your sugestion (:


Best regards,

Eduardo Coelho

You welcome, please give a like and Mark The answer has solution if i helped you :) 

Thanks. 

Hi Eduardo,

The default behavior of this component is to send to the server the value you see in the screen. In your example R$ 10.000.000.000 and since the variable you were using was an integer you were getting that error. The correct way of solving this is to use this "{removeMaskOnSubmit:true,autoUnmask:true}" in the AdvancedOptions. With this what will be sent to the server is 10000000000. Since you are using an integer you still will get errors because that is bigger than the integer limit. You can use a long integer instead.

PS: Next time you have doubts about a component ask you question on the component support that way the team that maintain it will be notified.

Regards,

Marcelo


Marcelo Ferreira wrote:

Hi Eduardo,

The default behavior of this component is to send to the server the value you see in the screen. In your example R$ 10.000.000.000 and since the variable you were using was an integer you were getting that error. The correct way of solving this is to use this "{removeMaskOnSubmit:true,autoUnmask:true}" in the AdvancedOptions. With this what will be sent to the server is 10000000000. Since you are using an integer you still will get errors because that is bigger than the integer limit. You can use a long integer instead.

PS: Next time you have doubts about a component ask you question on the component support that way the team that maintain it will be notified.

Regards,

Marcelo



Hi, Marcelo!

In our case (us here at the company), the real issue is the data type attribute as an Integer. I believe we will be able to change this to decimal or something more appropriate as we are talking about currency.

However, thank you for the clean explanation and the tips. I'll certanly use it in further situations.


Best regards,

Eduardo