1

I am not sure if this is can be done with a calculated column or with a sharepoint designer workflow, therefore I used both tags.

Basically I need a way to remove all spaces from an existing column. If he column reads "my text here", it should be changed to "mytexthere".

0

One would think that string manipulation were a trivial thing to do through either a calculated column or a workflow. The -sad- truth is that none of the two are of help for this specific task.

  • calculated columns: the problem is that (unexplicably, at least to me) they don't support the SUBSTITUTE function, so, although possible with a complicated multi-nested Replace function, I wouldn't go this way

  • designer workflow: in SP2010, there are no native string manipulation functions. If you are allowed to install farm solutions, then this CodePlex project can be useful. If you're on SP2013, then you can use the Replace Substring in String action

4
1

Generally the OOTB Replace string/utility action is what you want to use, but SPD throws an error if you try to leave any of the action parameters empty, so the trick is how to tell it to replace " " with "". In a 2013 Workflow (in SPD2013), just make local variables to hold your Space and Empty String, then use them in the Replace action, like this...

Set Variable:sSpace to 1
Replace 1 with {space} in Variable:sSpace (Output to Variable:sSpace)
Trim Variable:sSpace (Output to Variable:sEmpty)
Set Variable:sMyColumn to MyList:MyColumn
Replace Variable:sSpace with Variable:sEmpty in Variable:sMyColumn (Output to Variable:sMyColumn)
then Set MyList:MyColumn to Variable:sMyColumn

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.