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
shrey.tyagi88@tcs.comshrey.tyagi88@tcs.com 

Shorten text field from left hand side , by looking for specific character in the original value!!- Please help

Hi Everyone,
            I have a field called department . Possible values of department are given below . I want to make a formula taht looks for "-" betwwen the words and shortens the value from left hand side for e.g:

Original value : SSES-SPHERE-BHCJ-JSR-PSIS
Final Value: SSES-SPHERE

Original Value: ADM-CFO-FIN-CTLR
Final Value: ADM-CFO


Can anyone help me here please???

Regards
Shrey Tyagi

 
Lokeswara ReddyLokeswara Reddy
Hi Shrey,

You can try this apex
String s = 'SSES-SPHERE-BHCJ-JSR-PSIS';
List<String> parts = s.split('-');
String newString = parts[0]+'-'+parts[0];
 
Irvin Gustavo  Madrid GranadosIrvin Gustavo Madrid Granados
Try this..
LEFT(Name,FIND("-",Name,FIND("-",Name)+1)-1)