Removing ID and # sign from single line of text field


Badge +3

I used a site workflow to copy the values of two lookup fields to two single line of text fields so that I can delete the lookup fields. The site workflow updated the text fields but the values have an ID and # characters included before each. I was looking for a way to run a site workflow or list level workflow that would remove those values and leave only the intended text values. I assume it would involve  a regular expression function but I have not been able to figure it out the last few days.  Any help would be greatly appreciated.

 

Thanks,

Carl


10 replies

Userlevel 2
Badge +11

Put the lookup value inside a parseLookup() when adding it to a single line of text.

Badge +3

Thank you for your reply. Below are some screenshots of my site workflow that I used to update the text fields. I'm not sure how I would do that with this current set up. Thanks for your help, I have been stuck on this for a few days.

 

4009iFB98BD25CF943535.png4010i784E01724DB6E5B4.png4011i28B01E878B1FE2B0.png4012i26098F8764D452B6.png

Userlevel 2
Badge +11

In the Foreach you need to query the lookup fields for the current item and store them temporarily in a workflow variable. Next use a Set variable or Build string action to convert the lookup value workflow variable using parseLookup into a text workflow variable; you could consider to construct the entire string you want to use in the update. In the Update item use the workflow variable instead.

Badge +3

Does this looks correct? Thank you!

 

 

 

 

4013iC51A5A38B4A8E10F.png4014i21A6390FDFE7B848.png4018iBE3920DD5FD02E96.png4015iAD8BDFDF1F440490.png4016iADBFED3CA4DE086A.png4017i202EE03DED1A397F.png

Userlevel 2
Badge +11

That looks about right. Reusing the workflow variables is a good practice. Go ahead and test if this works correctly. If you do not yet want to update the item you can always first write each text.... workflow variable into the workflow history and confirm that it is now proper text.

Badge +3

Haven't been able to get it to work just yet. Question, will this update the text fields even if they still have a value in them from a previous workflow? I think it will but just wanted to be sure that wouldn't be a reason for it not to work.

 

Thanks,

Carl

Badge +3

Okay, so we're getting closer. Below is the result in SharePoint

 

4019i1753CB757B921389.png

Userlevel 6
Badge +22
The parselookup inline function is not available in the build string action. You may need to use a regular expression to remove the unwanted characters. If you provide an example of the output you are seeing I can show you how to configure the regular expression action to remove the unwanted characters.
Badge +3

Hey Simon,

 

Thanks for the reply and sorry for the delay, had a bunch of other things come up. I'm still experiencing this problem and wondered if you could help. The output I get currently when following the instructions above (minus the parseLookUp for now), looks like 

104;#HH Washington
 and I would like to remove the ID, semi colon and number sign from in front the name of the property. Thanks for any and all help.
 
Thanks,
Carl
Userlevel 6
Badge +22

Hi,

Use a regular expression action with the pattern:

^d*;#

e.g

4447i468BA75A1AD84927.png

 

I have hard coded your sample text in this example but using a variable for the input text will work.

The Pattern takes into account any number of digits at the start of the input.

Reply