You need to sign in to do that
Don't have an account?
Restricting Decimal Input
Hi,
My scenario is : I have a field of Number type and whose decimal point is set to 0.
If user enters any decimal data then it should show a validation message "Only numeric Values". But I can not achieve this. Can any one tell me how to use Reges to restrict user from entering any decimal no.
I am facing two problems. -
1. Can we have Regex on Numeric type field.
2. REGEX(NPS_Score__c ," ^[-+]?\\d+(\\.\\d+)?$"). i am using this expression to check if it contains and decimal then it will return true and error message will be flashed. I am getting "Incorrect Argument Type error".
Any help will be appreciated. Thank in advance.
With Regards,
Mayank Pant
There is no function index available. Can you tell me how can I achieve this? Thanks.
CONTAINS(TEXT(numberField),'.")
If the above returns true then error
Thanks for this.
I have set decimal places to 0 for my numeric field. If I enters any data with decimal value say 7.5 then saves it, it does not throw any error message as System validation rule which triggers before custom validation rule change it to 7 and therefore it does not throw error.
Now if I select 2 or 1 decimal place for the numeric field in data type, then it will throw the error and user has to enter only numeric data. But in my related list the value is shown as say 7.00 which is what business does not requires. Is there any way that this value should only be shown as 7 instead of 7.00.
Am I making it clear, what is the requirement?
Thanks for all this.
With Regards,
Mayank Pant
Yes. Is there any way to do it.
Thanks.
By the way, you can verify the number is a whole number using the validation rule: "FLOOR( NumberField__c ) != NumberField__c".
The column should honor your decimal settings. Are you displaying that value through a formula field? You might need to change the number of decimal places on the formula.