Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Nesting input variables inside of newly produced variables



This project extracts/manipulates data from a variety of banking institutions, and I'm trying to streamline my code by utilizing input variables better.  Is there a way to nest an input variable inside of an action's newly produced variable?


For example, if I want to activate an Excel worksheet by a Name, I can set an input variable as "Bank", then, Bank = "Citi".  Now this gives me a dynamic element that allows for copying and pasting one line for each separate bank.  Worksheet name = %Bank + '_Raw'%.  This will activate the Excel worksheet "Citi_Raw".  When my Bank input variable is changed from "Citi" to "Chase", this code will then activate the Excel sheet "Chase_Raw". 


I'm trying to take this one step further by storing a variable in this same manner.  For example, if I'm using the action "Read from Excel worksheet", I'd like to store the variable as %Bank + "_DataStore"%.  However, this syntax will not work.  I've also tried %Bank%"_DataStore" and %Bank%+"_DataStore".  Am I just missing the correct syntax here, or is this not possible in PAD?    

Power Participant
Power Participant

Hey Gordon,  to my knowledge, you cannot create a variable this way.  It is a limitation on most coding, and I hate it, because it seems so simple.  There are however options to get what you need.

Option 1 - Add Bank_DataStore to a list.  As it loops through, it will just keep adding to the list until the loop is over, and then you should be able to paste the list wherever you need to (I am not very familiar with the "how" on this, I just know it's doable in PAD.  For me, I haven't spent time on this, and I don't know how to recall from the list, so not having that knowledge, I would choose the next option.


Option 2 (my preferred option)  - make it part of the loop to change windows to a write file (I like Excel) where you need this data, and have it write the variable with an {Enter} at the end, so you make yourself kind of your own output file.  This can also be used as a reference file later.  So, if you need to recall this variable later, you can make it part of that loop to go to your write file and pull the data needed.


Best of luck.

Hey Michael,


Can you please elaborate more on Option 2?  I'm not really grasping the concept yet.  Thanks for your input!

So, I have a loop that goes to puts in a ticker symbol, and pulls the investment style, but I can't create a variable for %Ticker_Style% inside of the loop.  So instead, the loop itself has %Ticker% and %Style% that are both identified with each loop.  But let's say I have 100 tickers, and I need to recall specific styles for specific tickers in another loop later, once my first loop reiterates, %Ticker% and %Style% have been overwritten, so I need to save that data somewhere else for later reference.  This is where option 2 comes in.

In my first loop, I "Write to Excel" %Ticker% to column A and %Style% to column B.  So, at the end of my first loop, all %Ticker% are in column A and all %Style% are in column B.  Now when I am running my second loop, I can reference my write file for the needed data.  So, let's say loop 2 is running through a different set of tickers, but we want to see if the %Style% appears from the first loop.  In C1, "Write to Excel" =Vlookup(%Ticker%,$A:$B,2,False).  The result will be the %Style% for that ticker.  Then you can use "Read from Excel Worksheet" to pull the %Style% back into the new loop.

Hope this helps.

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,263)