Hello,
I'm trying to create a renting app for our users. They add some items into gallery and hit "rent" button. I would like to have my SP list updated in column "DostupneKlice" by -1 when reting.
I have this on my rent button:
Hello,
I'm trying to create a renting app for our users. They add some items into gallery and hit "rent" button. I would like to have my SP list updated in column "DostupneKlice" by -1 when reting.
I have this on my rent button:
I managed to get my Patch function working with this:
Hello,
I would suggest using the ID instead of Title. And in situations where you are not sure which column is being used you can use the AddColumns function. You can try something like this:
ClearCollect(temp, AddColumns(GalleryScannedKeys.AllItems, "Identificator", ID));
ForAll(
temp,
Patch(
SeznamBytuKarvina,
LookUp(SeznamBytuKarvina, ID = Identificator, ThisRecord),
{ DostupneKlice: DostupneKlice - 1 }
)
);
Unfortunately both of these give me same fetch error.
hey @Chlopky
can u try this:
ForAll(GalleryScannedKeys.AllItems, Patch(SeznamBytuKarvina, LookUp(SeznamBytuKarvina, Title = Title, {DostupneKlice: DostupneKlice - 1})))
or this:
ForAll(GalleryScannedKeys.AllItems,
With({currentTitle: Title},
Patch(SeznamBytuKarvina, LookUp(SeznamBytuKarvina, Title = currentTitle, {DostupneKlice: DostupneKlice - 1}))
)
)
Let me know if my answer helped solving your issue.
If it did please accept as solution and give it a thumbs up so we can help others in the community.
Greetings
Title = Title doesn't work. I tried GalleryScannedKeys.Selected.Title, this now goes without an error but instead of editing existing record in my SP list and decreasing the number. It creates new record, all metadata is empty except DostupneKlice column which records 1 (see screenshot).
Yellow is the record I was searching for and displaying in my gallery and wanted to decrease, red is new empty record created by clicking button "Rent".
hi @Chlopky ,
The issue seems to be with how the LookUp function is used inside the Patch function. Specifically, ThisRecord.Title might not be recognized correctly in this context. Instead of ThisRecord.Title, try using GalleryScannedKeys.Selected.Title or referencing the item directly from the ForAll iteration.
ForAll(GalleryScannedKeys.AllItems,
Patch(
SeznamBytuKarvina,
LookUp(SeznamBytuKarvina, Title = Title),
{DostupneKlice: DostupneKlice - 1}
)
)
WarrenBelz
146,668
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,004
Most Valuable Professional