Afternoon all,
So I'm attempting to auto increment a number field in SP. I have this working currently using this:
Patch(
faqCol,
ThisItem,
{'# Searches': suggested.'# Searches' + 1});
ForAll(
faqCol,
Patch(
'FAQ Dataset',
LookUp(
'FAQ Dataset', faqCol[@ID] = ID),
{'# Searches': faqCol[@'# Searches']}))
faqCol is the collection that I'm using for the Items field of a gallery. Every time an item is selected, I want it to auto increment its "# Searches" column by one. The above code does this fantastically, but after looking at the performance monitor, it's taking quite a while to work through them as the code above tells it to update every item's "# Searches" field.
I did it this way after reading a few posts and experiencing that if I just have it so that when the item is clicked it updates the SP field (rather than passing through the collection), it doesn't perform the patch on every click. The above code is the only way I can be sure the field will be updated every single time.
Is there any way for me to get it so that only the item selected has it's "# Searches" field updated, and that works consistently every time?