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 / Custom variable index ...
Power Automate
Unanswered

Custom variable index within a Python / VBA / Javascript script

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

is there a possibility to pass a variable as property for a power automate variable, like datatable? so selecting a value passing a dynamic index to datatable, something like that:

 

%Variable_Datatable[custom_index][custom_index]% 

 

I've tried with making custom_index as environment variable, but I cannot set it inside the script, in the loop... so it remains static....

 

example I want to achieve:

 

for i in range(0,5):
 %Variable_Datatable[i][i]%

 

 

Thanks!!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    You should be able to pass JSON object to PAD.

    In your JSON object you can pass multidimensional array

    And use "Convert JSON to custom object" action to use the object values.

     

    Hope this helps 🙂

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous, ok thanks (i see the other reply) but inside a Script (like in python)? it is not possible to retrieve a dynamic value with the custom object?

  • burque505 Profile Picture
    398 on at

    @Anonymous, at least with the Python 2 inside PAD it is possible.

    pyvars.png

    Script blowup:

    script.png

     

    I will see if I can get Python 3 to cooperate, that would be better for me.

    Regards,

    burque505

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @burque505 ,

     

    thanks but I was meaning retreving a value passing custom index, so in this way:

     

    %Variable_Datatable[i][i]%

     

     

    Thanks

     

  • burque505 Profile Picture
    398 on at

    Let me give that a try. Will report back. I have the suspicion the indexer may also need to be a variable, something like:

    for %i% in range(0,5):
     %Variable_Datatable[%i%][%i%]%

     

    but I admit this doesn't look right. I don't have anymore time this morning to experiment, but I'm certainly looking forward to seeing someone solve this for you.

     

  • fraenK Profile Picture
    2,125 on at

    Why don't you loop through the data table within PAD and execute the script per step or handover the full data table to the script and use the script's functionality to access the individual cells?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @fraenK ,

    because of the time... the loops connector are too slow and also to take advantage of scripting power.

    I don't understand this part

    handover the full data table to the script and use the script's functionality to access the individual cells

    what do you mean? 

    Thanks

    @fraenK 

  • fraenK Profile Picture
    2,125 on at

    You declare a variable at the beginning of the (Python) script and set its content to the content of your PAD data table variable:

    pyDT = %Variable_Datatable%

    Then loop through the pyDT with the package of your choice.  

  • fraenK Profile Picture
    2,125 on at

    The following statement is missing from the UI, that's why your initial idea doesn't work:

    Within the script, you may include variables, since they will be evaluated prior to the code's execution.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    hi @fraenK 

    it doesn't work because the data table have its values separated with commas, and also without the double quote on string character. this generate an issue when passing it as variable

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

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 432

#2
11manish Profile Picture

11manish 313 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 154

Last 30 days Overall leaderboard