cancel
Showing results for 
Search instead for 
Did you mean: 

Removing 234;# ID from the front of user name with Regular Expression

don
Nintex Newbie
2 3 1,280

I Recently had a request to get a Project Manager name that is linked to a project when the user selects a project number from a drop-down control.

I managed to get the Project managers name using this formula : lookup("Project List", "Project_x0020_Number", parseLookup(Project), "Project_x0020_Manager"). The only issue was I was also getting the ID along with the name. e.g.  234;#Joe Soap.

So, to fix this I used a regular expression to remove the ID from the front of the Project Managers name.

Steps I took:

1. I created a Form Variable. The formula I used to get the project managers name is : lookup("Project List", "Project_x0020_Number", parseLookup(Project), "Project_x0020_Manager")

"Project List" - is the name of the list that has the project number and project managers name in it.

"Project_x0020_Number"  - is the Project number for the Project. 

"Project" is the name of my drop down control that displays the list of Project numbers in it.

"Project_x0020_Manager" - is the name of the column in the "Project List" list that has the Project managers names in it.

2. I added a Calculated Value control to my Form. I used the regular expression in the formula to remove the characters before the #. 

This is the formula : replace(GetPMName, ".*#", "")

"GetPMName" - is the name of the form variable I created that holds the Project manager name with the ID attached to the front. e.g. 234;#Joe Soap.

".*#", ""  - is the expression I used. It removes everything before the # and replaces it with a empty string.

End result : Joe Soap.

Hope this helps someone. 

3 Comments
jpmhuls
Nintex Newbie

Good alternative to using parselookup(), which also removes the 'prefix'.

don
Nintex Newbie

Thank you, Jean-Pierre.

True, parseLookup() will also remove the ‘prefix’, though I found it did not work well when I used it.  

hayleea0601
Nintex Newbie

Thank you! This was very helpful.