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 / Expression doesn't rea...
Power Automate
Unanswered

Expression doesn't read variable as index to get an object from array

(0) ShareShare
ReportReport
Posted on by 3

I'm comparing the current SharePoint List item vs its previous stage. I'm using Send an HTTP request to SharePoint then I Parese JSON it to get an array of version. I have no trouble getting an entire version history. However, when I try to get the previous version through Initiate Variable I ran into trouble.

KRyadchenko_0-1718313781611.png

When I hardcode the array index inside of the Initialize Variable I have no trouble. Initialize Variable component gives me an array with a single object.

KRyadchenko_1-1718314015523.png


However, when I try to use a previously initialized variable as an index the flow returns me an empty array.

KRyadchenko_2-1718315835907.png

Please help me resolve that problem.

Categories:
I have the same question (0)
  • v-yetonggu-msft Profile Picture
    Microsoft Employee on at

    Hi @KRyadchenko ï¼Œ

    Please make sure that you initialized the variable Index before the type is an integer, and check the input of the Past Project array.

     

    Best Regards,

    Sunshine Gu

  • KRyadchenko Profile Picture
    3 on at

    Thank you.
    Yes, I've checked the variable in the past flow to verify that I get Index as Integer.
    I've also checked that the Index variable is within the length of the array.

    KRyadchenko_0-1718376672956.png

    I'm also checking the Index variable with Compose. It shows if the value of the Integer is still valid. And it is.

    KRyadchenko_3-1718377272407.png

     

    So with the length of Array 29 I'm trying to get 27th object of the array and get an empty array

    KRyadchenko_1-1718376851248.png

    Here is the expression for PastProjects

    KRyadchenko_4-1718377387924.png

     

    While hardcoded Index used in VersionList variable returns me an array of past version.

    KRyadchenko_2-1718376915874.png

    Here is the expression for VersionList

    KRyadchenko_5-1718377497276.png

     

    So I'm quite confused as to why Power Automate produces an empty array when the index of an object is set as a variable. I guess is that the Index variable gets assigned parallel to using it as an Index.
    Please help 😞

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 552

#2
Valantis Profile Picture

Valantis 388

#3
11manish Profile Picture

11manish 375

Last 30 days Overall leaderboard