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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Nesting input variable...
Power Automate
Unanswered

Nesting input variables inside of newly produced variables

(0) ShareShare
ReportReport
Posted on by

Hello,

 

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?    

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    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.

  • Community Power Platform Member Profile Picture
    on at

    Hey Michael,

     

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

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    So, I have a loop that goes to morningstar.com 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.

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard