cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

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
Highlighted
Resolver I
Resolver I

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
Highlighted
Resolver I
Resolver I

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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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