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 / First() Returns same S...
Power Apps
Answered

First() Returns same SharePoint item

(0) ShareShare
ReportReport
Posted on by 142

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

 

 

Categories:
  • Verified answer
    Draax Profile Picture
    142 on at

    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.

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 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard