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 / A variable within a va...
Power Automate
Unanswered

A variable within a variable

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello. 

 

I have an issue, where I need the name of a variable to be dependent on the value of a different variable. 

So I have:

Variable A = %NR% = 1

Then I need a second variable to be dependent on this number.

EX:

Variable B = %Family(%NR%) %. = Family1.

 

My question how I write this the proper way, so I get the outcome as shown above?

 

Can someone help? 🙂 

 

Kind Regard

I have the same question (0)
  • Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    In this specific example, 'Family1' can be outputted with the sntax %Family%%NR% but I have a feeling that your challenge is a bit more complex. Can you bring more examples?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Yes it is. 

    I need to get the variable produced to have a variable within itself. 

    sokeson_5-1643893429360.png

     

    So as shown above the variable produced should look like this: Fam1URL

    But the nr. should be dependent on a different variable. In this case %FamNr% 

    When I click save or use the option you showed it won't save the variable. 

    It will just deselect 'Variable produced'. 

     

     

     

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Then when i increase the variable.

    The variable produced should also change name. 

  • Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    Ahhh... 

    Scroll down and read about custom objects: Variable data types - Power Automate | Microsoft Docs

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    You cannot create variables using a flow.  This is created by design, and the same rule applies in Excel VBA.  As useful as it may be they don't allow you to.

     

    Alternatives:

     

    1. Create a List %URLs%.  For example, lets say I am iterating through a list of families, and each family gets a URL, but I don't know how many families there are before the flow starts, so I cannot designate %Family1% through %Family#% before the flow starts.  I create a list before the loop on families, and during the loop I add the URL to the List %URLs%.  Assuming a 1 to 1 relationship, the index on List %Family% will directly relate to the index on List %URLs%.  So when you need to refer back to the URL for a specific family, you can refer back to the %URL% List
    2.  You write everything to Excel:  Family name column 1, URL column 2.  You can look this up later.  Or you write the family name to C1 and a lookup formula to D1, then you read the value of the lookup formula to pull the URL later.
    3. A very complex way, that I have succeeded in is calling another bot.  This bot's purpose is to create another flow that creates the variables and sets them up as environment variables, then it runs.  Then your original bot calls the environment variables that were just created.  This is extremely difficult, and I believe extremely unnecessary.  I just did it to see if I could.

    Good luck!

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 410

#2
Vish WR Profile Picture

Vish WR 289

#3
David_MA Profile Picture

David_MA 282 Super User 2026 Season 1

Last 30 days Overall leaderboard