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 / Get variable inside a ...
Power Automate
Unanswered

Get variable inside a power automate expression

(0) ShareShare
ReportReport
Posted on by

Hi, Im trying to make a dynamic adaptive card that show input dynamically depending on some data fetch from my database, so far i've done quite good. But I'm stuck here. When i get the output from the adaptive card i try getting my field by a generated id with an iterator number (ex : id_iterator) so that i can loop, fetch the data and create a row in my db) but i can't manage to insert my variable inside my expression without creating a string variable before for each of my field. which i don't want to do... this is what i got so far

JayBert_0-1636575758293.png

and my expression is as followed : outputs('ad')['body/data']['Fournisseur_variables('iterator2')']

but it keep saying it's not valid. is there a to inject the variable after the '_' ?

 

other thing i tried that work (while i was testing to make sure it could work first). i just initialize the variable to inject instead of trying to get the input directly in the expression (this is what i try to avoid):

JayBert_1-1636575953695.png

outputs('adc')?['body/data']?[variables('code')]
 
 
I don't know if this all make sense. Thanks
Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Anonymous,

     

    If I understand your requirement correctly a concat function might help.

     

    Which field from ADC action do you want to use in your expression together with the variables code?

     

    Below is an example of a concat:

    concat(outputs('adc')?['body/data']['somefield'],variables('code'))

     

  • Community Power Platform Member Profile Picture
    on at

    Hey thanks for the answer, i've tried it, and while the expression is valid, i'ts not working in my case... (Edit: i think it's because the expression is processing outputs() before concat() so it doesn't find my 'inputId_')

    JayBert_0-1636643151806.png

    I'm trying to get all id_x where x is the iterator value

    context/exemple:

    let's say i have a task table, and a people table, a person can have many task. I get all the task of a user, and build a card and send them the card with an input for each task to know if they have done it. But since i don't know how much task they had, and i want to send this card to each of them respecting their individual task. all card must be build dynamically. 

    So i manage to build the card dynamically. so it could look like this when the user receive it (exemple, i just simplified my context) cause as you can see in my error. i have many more field. wich is why i don't want to declare a variable for each of them):

    JayBert_1-1636643641010.png

    so each row was added dynamically with the id -> Task_X. so when i get the card i want to do something like:

    for( int i = 0; i < rowcount; i++)

    {

         get my field value dynamically (Task_i)

    }

     

     

    Sorry if it's still not super clear... it makes sense in my head. for now i'll go for my solution that i wanted to avoid since i know it's working... i'll wait for your input.

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Anonymous,

     

    It does make sense. You want to dynamically determine what the correct field is to retrieve in the expression. You want to do that by using an iterator and to apply the code variable with the correct incremented integer value. So if you would be in row 3 of your do while loop, the field in the expression you want to retrieve would be Fournisseur_3. 

     

    However, it looks like the expression editor can't handle this kind of logic. I have also tried several things. It will just output the variable as a string and doesn't use it to retrieve the correct field.

     

    I am interested in the actions before your do while loop. We might be able to find a workaround for this. Can you share the first part of your flow with the ADC action?

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard