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 / Lookup exact value fro...
Power Automate
Answered

Lookup exact value from the array and update SharePoint item

(0) ShareShare
ReportReport
Posted on by 32

Array looks like this:

[
  {
    "ID""LeaveType01",
    "Used""3",
    "Planned""2"
  },
  {
    "ID""LeaveType02",
    "Used""4",
    "Planned""5"
  }
]
 
Is there a way to lookup values and then use them as strings in the Update Item action?
 
For example to update LeaveType01Used value then use similar function - LookUp(Array, ID = 'LeaveType01').Used
 
kevindeket_0-1672073444373.png

 

Categories:
I have the same question (0)
  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    I would convert your JSON array to XML so we can use XPath to extract out the values you want.

     

    See flow below that extracts out the Used and Planned numbers for LeaveType01. I'll go into each of the actions.

    grantjenkins_0-1672103667875.png

     

    Compose contains your array of objects. You can just use the array you already have.

    grantjenkins_1-1672103706766.png

     

    XML is a Compose that converts the array to XML so we can use XPath expressions. The expression to convert to XML is below. Note that it also adds a root element to ensure it's valid XML.

    xml(json(concat('{"root": { value:', outputs('Compose'), '}}')))

    grantjenkins_2-1672103801929.png

     

    The next two Compose actions are examples of extracting out the numbers. The expressions used are below. Note that you would just use the expressions directly within your SharePoint Update item action.

    //LeaveType01 Used
    xpath(outputs('XML'), 'number(//value[ID="LeaveType01"]/Used/text())')
    
    //LeaveType01 Planned
    xpath(outputs('XML'), 'number(//value[ID="LeaveType01"]/Planned/text())')
    
    //To get your other values you would just need to add the ID and Property you want (Used or Planned).
    xpath(outputs('XML'), 'number(//value[ID="YOUR_ID"]/Used/text())')

    grantjenkins_3-1672103941609.png



    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • kevindeket Profile Picture
    32 on at

    Thank you so much for your help!

     

    I was able to collect all the balances in an array and then use the expressions in the Update Item action. I also made some adjustments to the expression to handle the case where the value doesn't exist. It worked perfectly. Thank you again for your assistance.

     

    kevindeket_0-1672142335592.png

     

    if(equals(string(xpath(outputs('XML'), 'number(//value[ID="LeaveType01"]/Used/text())')),'NaN'),'0',xpath(outputs('XML'), 'number(//value[ID="LeaveType01"]/Used/text())'))

     

    kevindeket_3-1672142732322.png

     

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 604

#2
Valantis Profile Picture

Valantis 502

#3
Vish WR Profile Picture

Vish WR 417

Last 30 days Overall leaderboard