cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Draax
Level 8

First() Returns same SharePoint item

Hello,

 

I have an app where I save a SharePoint item in a local basked for checkout.

 

Its setup like this, 

For example there is 10 apples each is one row in a SharePoint list.

 

I then have an button, add to basket which stores the ID of the row for later removal upon successful purchase.

 

However when i press the "add to basket" button it sometimes add the same item more than one time.

 

This is my code:

 

Refresh(Lager);


Patch(Lager, First(Filter(Lager, ThisItem.Title = 'Title (Title0)'.Value, Reserverad.Value = "Nej")), {
    
    Reserverad:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                        Id:Value(First(Filter(Lager, ThisItem.Title = 'Title (Title0)'.Value, Reserverad.Value = "Nej")).ID) ,
                       Value:"Ja"}

});

I first refresh the stock (lager) patching the first item that is not reserved to reserved.
Then if i press the button again it should get the next available item but it only works 50% of the time.

 

 

Any ideas?

 

-Draax

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Draax
Level 8

Re: First() Returns same SharePoint item

For some reason i did the First() function several time during the code, instead i put up a veriable which did it once and now it works just perfect.

View solution in original post

1 REPLY 1
Draax
Level 8

Re: First() Returns same SharePoint item

For some reason i did the First() function several time during the code, instead i put up a veriable which did it once and now it works just perfect.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,997)