cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
poortom1004
Regular Visitor

Error running Flow on an initialize array step

I was able to save my flow (no syntax issue) with an initialize variable step, type is array.  The purpose of the array is to hold characters that I want to strip from a value in a further step inside of an Apply to Each step.

I was following the guidance on this page: Remove unwanted characters from a string in Power Automate (tachytelic.net)

When I go to run the flow, I get an error stating the following:
The variable 'RemoveCharsArray' of type 'Array' cannot be initialized or updated with value of type 'String'. The variable 'RemoveCharsArray' only supports values of types 'Array'.

The value for the RemoveCharsArray is the following:

[" ","\","/","%","&","*","+","=","?","{","}","|","<",">","(",")",";",":",",","[","]","~","`","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","¢","£","¥","₧","ƒ","á","í","ó","ú","ñ","Ñ","Char(34)"]

As you might be able to tell, I am wanting the array to contain these characters, which will end up being removed from an input of a previous step.

The characters I am wanting to remove are the following:

space
backslash \
percent %
ampersand &
asterisk *
plus +
slash /
equality sign =
question mark ?
left curly bracket {
right curly bracket }
veritcal bar |
less than <
greater than >
left parenthesis (
right parenthesis )
semicolon ;
colon :
comma ,
left square bracket [
right square bracket ]
double quote " (Escaped by Char34)
tilde ~
accent `
at sign @
period .
diacritical characters éâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñÑ

1 ACCEPTED SOLUTION

Accepted Solutions
poortom1004
Regular Visitor

I ended up fixing this.  The backslash (\) was getting escaped when I didn't want it to.  To get around this, I used the unicode equivalent "\u005C" in place of "\".  After I saved the flow, the array values automatically converted the unicode value back into the backslash along with the proper escaping required, which ended up being "\"".  Additionally, I was wanting to have the double quote character in the array, and the way I was using it was apparently wrong, so I used the same method of using the unicode value \u0022, which again after I saved the flow, automatically updated the array value to "\\"

View solution in original post

4 REPLIES 4
abm
Super User
Super User

Hi @poortom1004 

 

There may be couple of ways to do this.

 

image.png

 

image.png

Above expression I used is as follows:

split(variables('SpecialCharacters'),',')
 
Above I have initialised an array and declared all the characters in a string. Then in next step I used the expression split to separate each values and append to array. Finally you have an array with all those characters.
 
image.png
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
poortom1004
Regular Visitor

This doesn't work.  I get the same error.  Can someone help me troubleshoot the error instead of providing a different way of doing things?

poortom1004
Regular Visitor

I ended up fixing this.  The backslash (\) was getting escaped when I didn't want it to.  To get around this, I used the unicode equivalent "\u005C" in place of "\".  After I saved the flow, the array values automatically converted the unicode value back into the backslash along with the proper escaping required, which ended up being "\"".  Additionally, I was wanting to have the double quote character in the array, and the way I was using it was apparently wrong, so I used the same method of using the unicode value \u0022, which again after I saved the flow, automatically updated the array value to "\\"

Hi @poortom1004 

 

I tested this and it does work. Send me your email id and I could forward my flow for you.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (5,201)