You need to sign in to do that
Don't have an account?
gowtham murugesan
how to save a Data( Number) include space ?
Hi all,
I have a custom field called "Amount"
this my input "123456"
But need to display as "123 456" like this format.
How to include space in this using trigger?
thanks in advance
I have a custom field called "Amount"
this my input "123456"
But need to display as "123 456" like this format.
How to include space in this using trigger?
thanks in advance
If You are using a text field than to create space in a value use below code. This code will create space between charaters of string in half of the length of String.
for eg:
For 6 digit length of string : Space will be after 3 charaters.
For 8 digit length of string : Space will be after 4 charaters.
For 7 digit length of string : Space will be after 3 charaters.
Now you can assign this value to any text type field.
Thanks,
Ajay Dubedi
All Answers
A number type field cannot contain space between digits even leading zeros also removed.
If we will force to insert it as containing space it will generate an error:
System.TypeException: Invalid integer:
My suggestion is to create your field as a text type.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
Here the field datatype is "text"
If You are using a text field than to create space in a value use below code. This code will create space between charaters of string in half of the length of String.
for eg:
For 6 digit length of string : Space will be after 3 charaters.
For 8 digit length of string : Space will be after 4 charaters.
For 7 digit length of string : Space will be after 3 charaters.
Now you can assign this value to any text type field.
Thanks,
Ajay Dubedi