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
RT2311RT2311 

Trim a value of Picklist Field

Hi,

I am trying to trim a value of a picklist field and store it in another field via formula .

For example:

Picklist value "ABC-EDF-Item1"
"ABC-EDF-Item2"
"ABC-EDF-Item3"
"ABC-EDF-Item4"

to
"Item1"
"Item2"
"Item3"
"Item4"

Thanks
Rohit

 
UC InnovationUC Innovation
Hi RT2311,

Just for clarification? Do you want to do this to the selected value or make a picklist based on this picklist?
RT2311RT2311
UC Innovation,

No i found the solution

IF ((ISPICKVAL( picklist field,'ABC-EDF-Item2')), 'Item2',null)

But here is my major question. what would be the best solution if i have 100 picklist values and i should show them in a formula. (limitations of formula). Apart from that i want this to happen for all my picklist values its not a single selected value.
UC InnovationUC Innovation
You can try this for a more dynamic solution so you wont have to hard code each option. This works for you if all of the options contain Item<NUMBER>.

RIGHT(picklist field, 5) 

This will return a substring with the last 5 characters in the selected option. If your picklist options dont all end in itemX then try checking the field for that substring and doing an if statmetn around that.

CONTAINS(picklist field, 'Item')

Hope this helps!

AM
RT2311RT2311
What if i have a the picklist values as below
TSD - DEV - Amemndment
TSD - DEV - Closure
TSD - DEV - Blocked

the list goes on to a hundred values and i want those to be displayed as being a global picklist field 
Amendment
Closure
Blocked

Thanks
RT
RT2311RT2311
So the first name space is common and the last values are the same, now that i want to remove the whole namespace and just display the values in the picklist
Parker EdelmannParker Edelmann
Would it be possible to just re-create the Global Picklist or rename the values? It seems like that would be a better solution than a formula.

Nevertheless, if it's a formula that you want, and the values are always in the form "TSD - DEV - ______", then try something like this:
 
MID( TEXT(picklist_field__c), 13, LEN(TEXT(picklist_field__c)) - 12)


Regards,
Parker

Mark Deguisne 7Mark Deguisne 7
Have a picklist field that displays text options '1 Night', '2 Nights', '3 Nights', etc. to designate how many nights a reservation is for. Without changing or replacing those picklist values, I need to convert them to Numbers so I can properly report off that information. This is the formula I have tried, however, am not having any luck. Any thoughts?:

IF (ISPICKVAL(  Number_of_Nights__c ,'1 Night'), '1',
IF (ISPICKVAL(  Number_of_Nights__c ,'2 Nights'), '2',
IF (ISPICKVAL(  Number_of_Nights__c ,'3 Nights'), '3',
IF (ISPICKVAL(  Number_of_Nights__c ,'4 Nights'), '4',
IF (ISPICKVAL(  Number_of_Nights__c ,'5 Nights'), '5',
IF (ISPICKVAL(  Number_of_Nights__c ,'6 Nights'), '6',
IF (ISPICKVAL(  Number_of_Nights__c ,'7 Nights'), '7',"")))