I have been struggling to get this right and finally found a solution from Alan (Flow: Stripping Unwanted Characters or Special Characters From a String - Flow - AlanPs1.io) that at least saves and tests cleanly... that said I have two questions since I'm a novice at this and I need this to work for other flows I still need to build...
So, question 1 is... when defining an apply to each, do you have to do this iteration for every field that possible contains the characters or can you just define all the fields where the characters will be found in a single compose action? My flow looks like this...
I tried to select all the fields where I know the characters exist that I want to remove i.e. ('[', '"','|', ']')
then I want to enter the routines where the variables are declared and the apply to each loop routine (as per Alan's example)
and this is the part I'm not sure of question 2... does this have to be repeated for each field containing the characters to be removed? or will this take care of all of them since they were all specified in the 1st compose select box?
and now finally the last part of the question is, how do I input the "cleaned data" into the template I am using to create a document? question 3...do I reference the output of the last compose which is my exit of the apply to each loop in the template field, instead of its dynamic reference? the circle below is what I am referring to when I update the template, must this be the dynamic content field or must it be output of the sanitise routine above? and if the latter can I use the same "sanitise" output in each field I declared up front that I want to clean?
Any help appreciated as I've had sleepless nights trying to figure this out...
Thanks for reaching out via my blog post
think you need to supply a sample input and output. Are you dealing with multiple choice questions? It looks like you are combining many multiple choice questions into a single array and then trying to convert to a string whilst removing the square brackets of an array? Please share the history output of the compose and then the desired output.
Please take a look and subscribe to my YouTube Channel for more Power Platform ideas and concepts. Thanks
Hi Damien @DamoBird365 ,
Thank you so much for replying, apologies for taking so long to respond, but with all the changes I made in the flow, I just needed to get back to a simple clean run. Anyhow I seem to have narrowed down what the problem is, I just don't know what the right way is to fix it...
The problem stems from all columns which are defined in the SharePoint content type as multi-line text fields (all the single line fields appear exactly as I need them to). The only reason I created them as multi-line columns is because on most of them, I exceed the 255-character limit when some of the multiple selections are made in the form. The screenshot here shows what is appearing in both the SharePoint display (which I don't really care about), but also in the word document I created during the flow run...
Word document, all multi-line text fields contain [" "," and "] characters:
Same is happening in SharePoint...
SharePoint Content Type Column definition is:
The desired outcome is just to get rid of the [" "," and "] characters, I have 19 columns that have this problem, hence my original post of trying to get the data from all 19 columns and stripping the characters out, I then tried to perform a "strip loop" for every column to strip the characters before they populate the word template in SharePoint also to no avail. I have seen many examples of stripping characters, not quite the same use case (most of them are referring to cleaning data before an email gets composed). I have also seen suggestions on using a "replace(replace(replace(body('Get_response_details_from_the_MS_Form')?['body/rxxxxxx'],'","',', '), '["',''), '"]','')" string on the final document creation field, but also seen people posting that this method can make debugging down the line difficult. I just want to find the simple way to do it for all 19 columns ...
Any help you could give would be appreciated.
Keep up to date with current events and community announcements in the Power Automate community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!