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 / Auto Increment SharePo...
Power Apps
Unanswered

Auto Increment SharePoint Column Issue

(0) ShareShare
ReportReport
Posted on by 364

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?

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @EpicTriffid 

    If you just want to increment the # Searches column for the selected item in your list, then consider the following formula instead:

       UpdateIf('FAQ Dataset', ID=ThisItem.ID, {'# Searches': suggested.'# Searches' + 1})

     

    There is no need for a collection of ForAll loops for this as they will kill your app performance this way.

     

    I hope this is helpful for you.

  • EpicTriffid Profile Picture
    364 on at

    Hi @RandyHayes 

     

    Here you are, helping me again!

     

    Unfortunately, while the formula you suggested works to increment the "# Searches", it will only do it once for each item, and not every time the button is clicked. I've tried this in both edit and play modes and it does the same thing. 

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

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard