cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Nintex Newbie

Split document name and use characters in For Each

Hi,

I have a SharePoint document Library in which users often upload documents with special characters in the document name. I'm looking for a way to detect the special characters, save them into a collection variable, replace them for valid characters and rename the document back to SharePoint. 

So, for example, document with name "Test-1-ábc", (I've already found a way to remove the extension), when running through the workflow, the "á" character needs to be replaced by a simple "a", so the new name of the document will be "Test-1-abc".  Has any one tried this before? can you please shed a light on how you would try this on your end? No need for specific expressions, just looking for ideas on how to achieve this.  Thank you!

Labels: (1)
0 Kudos
Reply
3 Replies
Highlighted
Nintex Newbie

Re: Split document name and use characters in For Each

Hi Rigo,

Unfortunately, Nintex does not have a Normalize-like feature. However, one thing that you can try is to use an XML/JSon/CSV file that contains all the special characters and their equivalents (e.g. https://www.basvanbeek.nl/php/normalize-special-characters/).

Then, while iterating through the file, replace (if found), the special character with its equivalent and voila!

If you need any more help, let me know!
0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Split document name and use characters in For Each

Thanks Michel,

I already have the definition of the characters that need to be replaced. I was actually looking for ideas on how to make the "replace" part happen. Fortunately I was able to figure this out after a lot of testing. My workflow now is able to complete the following steps (this is using Nintex On Prem, SharePoint 2016):

1. Detect when a new document is uploaded to the SharePoint Document Library

2. Scan the document name and remove the extension

3. Compare each character in the document name to the defined list of invalid characters

4. Change the characters that need to be changed e.g. "á" becomes "a", and remove the ones that cannot be part of the name e.g. "$" is removed from the document name

5. Concatenate all valid parts of the name and make a new name string, e.g. document "My#1Dócument2020!" will be changed to "My1Document2020"

6. Use that name string to update the file name in SharePoint, this part is actually not working yet, I expect it to be solved by tomorrow.  On the Update Item action, I select the Name property and replace with the new string. If I close that window and re-open it, the "Name" property will not be selected anymore. 

nintex120201.png

Thanks for taking the time to read my thread, I really hope this can help someonelse in the future; I'll be happy to share all the workflow actions I took to make this work.

 

 

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Split document name and use characters in For Each

Glad to read you've found a solution!
0 Kudos
Reply