function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Claire NicolayClaire Nicolay 

Format of a number field

I created a number field to insert the social security number. When i finish typing my 13 digit number, it appears like this:
1 111 111 111 111
Question1: why is it appearinglike this even though I did notenter any space between the digits
Question 2: is there a way to ensure with a field update that the number reads as follows: 1 11 11 11 111 111, or do I have to use a validation rule with regex?
Thanks!
Best Answer chosen by Claire Nicolay
karthikeyan perumalkarthikeyan perumal
Hello Claire, 

we can achive this using 2 ways. 
1. Using Number field with formula. 

Create a new custom field, where type is "formula" and the formula return type is "text".

In the formula, use the TEXT() function, and pass the existing number field value into this formula. For example, if your number field is SSN_c then your formula would be: TEXT( SSN_c )

Your users will enter values into the existing number field, but you can use the formula field (which doesn't display thousands separators)

2. we have use Text Field with regex validation rule for savving the record in Exact  formate like (1-11-11-11-111-11) 

Create a Text SSN_c custom field 
add the validation rule for this field

NOT(OR(REGEX(SSN__c, "^[0-9]{1}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{3}-[0-9]{3}")))

its give you the exact result what you want. 

Hope it will help you to solve your issue. 

kinldy mark Best ANSWER if it works for you. 

Thanks
karthik

 

All Answers

karthikeyan perumalkarthikeyan perumal
Hello Claire, 

we can achive this using 2 ways. 
1. Using Number field with formula. 

Create a new custom field, where type is "formula" and the formula return type is "text".

In the formula, use the TEXT() function, and pass the existing number field value into this formula. For example, if your number field is SSN_c then your formula would be: TEXT( SSN_c )

Your users will enter values into the existing number field, but you can use the formula field (which doesn't display thousands separators)

2. we have use Text Field with regex validation rule for savving the record in Exact  formate like (1-11-11-11-111-11) 

Create a Text SSN_c custom field 
add the validation rule for this field

NOT(OR(REGEX(SSN__c, "^[0-9]{1}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{3}-[0-9]{3}")))

its give you the exact result what you want. 

Hope it will help you to solve your issue. 

kinldy mark Best ANSWER if it works for you. 

Thanks
karthik

 
This was selected as the best answer
Claire NicolayClaire Nicolay
Thanks Karthik.It works