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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

 

Categories:
  • Manish Solanki Profile Picture
    15,169 Moderator on at

    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

    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

     

  • Manish Solanki Profile Picture
    15,169 Moderator on at

    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

    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

     

  • Manish Solanki Profile Picture
    15,169 Moderator on at

    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

    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
    Manish Solanki Profile Picture
    15,169 Moderator on at

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 302 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 130

Last 30 days Overall leaderboard