web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Initialize string variable error

(0) ShareShare
ReportReport
Posted on by 9

I have built the following flow and it runs perfectly to add a row to a table in a spreadsheet. However the 'raNumber' contains a comma after the number that I am trying to delete using a string replace. When I do that, I get an error that the raNumber variable has not been initialized (The variable 'raNumber' must be initialized before it can be used inside action 'splitRA'). When I add a step to initialize it, I get an error that I can't initialize a variable inside of a 'for each' loop. But if I put the step outside of the loop, PA doesn't see raNumber as dynamic content. How do I get rid of the comma in the raNumber variable?

 

jakeDS_1-1707922705836.png

 

I have the same question (0)
  • ManishSolanki Profile Picture
    15,089 Super User 2025 Season 2 on at
    Re: Initialize string variable error

    Hi,

     

    You need to initialize the variable before 'For each' action after 'When an email arrives' action, I mean between those two actions 😃

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • jakeDS Profile Picture
    9 on at
    Re: Initialize string variable error

    No, now the cell in the table is blank. I was mistaken earlier, it is returnCity that I am trying to remove a comma from, not raNumber. Below is the flow the way is currently looks:

    jakeDS_0-1707925517486.png

     

  • ManishSolanki Profile Picture
    15,089 Super User 2025 Season 2 on at
    Re: Initialize string variable error

    Hi @jakeDS 

     

    Could you pls share each action with input values passed to it? Please share the screenshots in edit mode.

     

     

  • jakeDS Profile Picture
    9 on at
    Re: Initialize string variable error

    Sure, here are screenshots. Let me know if you need more.

     

    jakeDS_0-1707925933995.png

     

    jakeDS_2-1707926086693.png

     

    jakeDS_3-1707926098879.png

     

    jakeDS_4-1707926109892.png

     

    jakeDS_5-1707926129090.png

     

  • ManishSolanki Profile Picture
    15,089 Super User 2025 Season 2 on at
    Re: Initialize string variable error

    Pls share the input value in 'returnCity' variable from previous flow instance. Also, share the expected value or final output.

     

     

  • jakeDS Profile Picture
    9 on at
    Re: Initialize string variable error

    The input value in 'returnCity' is the 0 space value of line 10 of the filter array.

     

    jakeDS_0-1707927450078.png

     

    In the array, line 10 reads

    "Batavia, IL 60510",

    I am trying to get it to output 'Batavia' instead of 'Batavia,'

  • Verified answer
    ManishSolanki Profile Picture
    15,089 Super User 2025 Season 2 on at
    Re: Initialize string variable error

    Hi @jakeDS 

     

    To remove comma, pls use the below expression:

    split(body('Filter_Array')[10],', ')[0]

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 797 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 425 Moderator

#3
developerAJ Profile Picture

developerAJ 319

Last 30 days Overall leaderboard