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 Platform Community / Forums / Power Automate / Initialize string vari...
Power Automate
Unanswered

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

 

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 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,091 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,091 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,091 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard