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 Apps / Patching To Parent/Chi...
Power Apps
Answered

Patching To Parent/Child Records

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

I have an issue which I cannot get my head around. I have two SPO lists, Orders & ItemsInOrder. I have a "shopping cart" system, whereby I create orders in one list, but the items themselves are in the second list and are referenced to an Order ID.

 

I am able to update the status of each item independently (each item can be marked as "on hold", "declined" etc) and this works well. What I am wanting to do is have the system patch the Order to the same status if all of the items are marked the same, so for example if all items are marked "on hold" the Order itself will be marked as on hold. I have two galleries, the first one is the gallery of orders and the second is those items linked to that order. Can anyone advise of how I could do this? I use a variable to set the selected Order for patching.

 

My patch for the OrderItems is: ForAll(Gallery7.AllItems,Patch(ItemsInOrder,{ID:ID},{ItemInOrderStatus:Dropdown2.Selected.Value}))

 

Thanks,

 

Chris

 

Categories:
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Could you please share a bit more about your scenario?

    Could you please show more details about the variable that you mentioned? Could you please share more details about the formula you used within the Items property of the second Gallery? Does the Gallery7 represent the second Gallery?

     

    Based on the formula you provided, I think you use this Patch formula to update the Order Items status in your second Gallery (Gallery7), is it true?

     

    Based on the needs that you mentioned, I think a Timer control could achieve your needs. I have made a test on my side, please take a try with the following workaround:

    Add a Timer control in your app, set the Duration property to following:

    1000

    set the AutoStart and Repeat property to following:

    true

    set the OnTimerEnd property of the Timer to following:

    If(
     CountRows(Filter(Gallery7.AllItems, ItemInOrderStatus = First(Gallery7.AllItems).ItemInOrderStatus)) = CountRows(Gallery7.AllItems),
    Patch(
    'Orders List',
    FirstGallery.Selected, /* or type LookUp('Orders List', ID = FirstGallery.Selected.ID) */
    {
    OrderStatus: First(Gallery7.AllItems).ItemInOrderStatus /* <-- OrderStatus represents the Status column in your Orders List, which is used to store the status value */
    }
    ) )

    Note: The FirstGallery represents the first Gallery in your app, which connects to the Orders SP List.

    If the OrderStatus column in your Orders List is Choice type column, please consider modify above formula as below:

    If(
     CountRows(Filter(Gallery7.AllItems, ItemInOrderStatus = First(Gallery7.AllItems).ItemInOrderStatus)) = CountRows(Gallery7.AllItems),
    Patch(
    'Orders List',
    FirstGallery.Selected, /* or type LookUp('Orders List', ID = FirstGallery.Selected.ID) */
    {
    OrderStatus: {
    Value: First(Gallery7.AllItems).ItemInOrderStatus
    }
    }
    ) )

     

    Set the Visible proeprty of the Timer to following:

    false

     

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-xida-msft Thank you, thats worked brilliantly.

     

    Many Thanks,

     

    Chris

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 Apps

#1
11manish Profile Picture

11manish 396 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 323

#3
WarrenBelz Profile Picture

WarrenBelz 193 Most Valuable Professional

Last 30 days Overall leaderboard