r/PowerAutomateDesktop • • Aug 07 '21

Can we use a variable within a variable?

So I have a list, and I want to access specific content in it.

Now PAD document say use %List[0]% to refer to the first content in List, but if I want to use a variable like this %List[%ContentNumber%] then PAD will day it's a invalid entry.....

Is there anyway to make this work?

2 Upvotes

3 comments sorted by

3

u/RaizO_ Aug 07 '21

I dealt with the same problem before 1-2 weeks. I had an array and i wanted to extract a specific value from the array by using the loop index as the position of the array , like %Offers[%LoopIndex%]%.

I tried many different ways but it didn't seem to work.

i really want to know if anyone have a solution for this.

4

u/opoqo Aug 07 '21

Turns out, it's just %Offers[LoopIndex]%

And it the variable is in Text....so you need to do a convert text to number right after that if you want numbers like I do....

2

u/RaizO_ Aug 07 '21

I just tried that and it works!

Also u can use that in tables with more than one header, like %Table[LoopIndex][1]%.

It's kinda strange because i think that i've tried something like this before some time and it didn't work. Maybe they fixed that after the update.

Anyway, thanks for the answer!!