cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WhatsTheAnswer
Level: Powered On

Patch multiple items from collection to respective locations in sharepoint list.

I have a simple collection called, 'BookingCollection' and I want to patch all items in this collection to a sharepoint list called 'BookingList'. 


Items are added to collection based on buttons clicked in a gallery ('SlotGallery', connected to 'BookingList'). Each button in gallery is for specific column in 'BookingList'. 

.......................

SlotGallery:

15-Jan-20:  Button1  Button2  Button3

_________________________________________

16-Jan-20:  Button1  Button2  Button3

_________________________________________

 

Button1> Collect( BookingCollection ,{DayVal2:Gallery4.Selected.DayVal, '08:00-08:30AM':"Booked"&";"})

Button2> Collect( BookingCollection ,{DayVal2:Gallery4.Selected.DayVal, '08:30-09:00AM':"Booked"&";"}) and so on..

.....................

BookingList: 

 DayVal      |   08:00-08:30AM   | 08:00-08:30AM  | 09:00-09:30AM

15-Jan-20

16-jan-20

 

I am trying to patch this using 'For all' and it works fine if all buttons are clicked in the same parent in gallery:

 

ForAll(
    BookingCollection,
    Patch(
        BookingList,
        First(
            Filter(
               BookingList,
                Value(
                    DayVal,
                    "[$-en-US]m/d/yyyy"
                ) = Value(
                    SlotGallery.Selected.DayVal,
                    "[$-en-US]m/d/yyyy"
                )
            )
        ),
        {
            '08:00-08:30AM': '08:00-08:30AM',
            '08:30-09:00AM': '08:30-09:00AM',
            '09:00-09:30AM': '09:00-09:30AM'
        }
    )
)


 

I need help in figuring out a way to patch if the collection has items from different parents in gallery. In this case, collection looks something like this:

 

08:00-08:30AM   | 08:00-08:30AM  | 09:00-09:30AM  |  DayVal2

Booked               |                            |                           | 15-Jan-2020

                           |   Booked             |                           | 15-Jan-2020

                           |   Booked             |                           | 16-Jan-2020

Booked               |                            |                           | 15-Jan-2020

                           |                            | Booked              | 16-Jan-2020

 

Can someone please point me in the right direction.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Patch multiple items from collection to respective locations in sharepoint list.

Hi @WhatsTheAnswer ,

Do you want to know how to patch collection's data to list based on DayVal2 and DayVal?

Could you tell me the data type of '08:00-08:30AM' field in list?

I assume that it is text type.

If so, please try this:

ForAll(
    BookingCollection,
    Patch(
        BookingList,
         LookUp(
               BookingList,
                    DayVal=DayVal2),
          
        {
            '08:00-08:30AM': '08:00-08:30AM',
            '08:30-09:00AM': '08:30-09:00AM',
            '09:00-09:30AM': '09:00-09:30AM'
        }
    )
)

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Patch multiple items from collection to respective locations in sharepoint list.

Hi @WhatsTheAnswer ,

Do you want to know how to patch collection's data to list based on DayVal2 and DayVal?

Could you tell me the data type of '08:00-08:30AM' field in list?

I assume that it is text type.

If so, please try this:

ForAll(
    BookingCollection,
    Patch(
        BookingList,
         LookUp(
               BookingList,
                    DayVal=DayVal2),
          
        {
            '08:00-08:30AM': '08:00-08:30AM',
            '08:30-09:00AM': '08:30-09:00AM',
            '09:00-09:30AM': '09:00-09:30AM'
        }
    )
)

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

WhatsTheAnswer
Level: Powered On

Re: Patch multiple items from collection to respective locations in sharepoint list.

Thanks. I figured that out yesterday 🙂

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,792)