Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
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.

  • KRyadchenko Profile Picture
    3 on at
    Re: Expression doesn't read variable as index to pull get an object from array

    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 😞

  • v-yetonggu-msft Profile Picture
    on at
    Re: Expression doesn't read variable as index to pull get an object from array

    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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,708 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,030 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow