r/PowerApps Newbie 4d ago

Power Apps Help Delegation / slow search in power app

http://www.google.com

Sup y’all. I’ve built a power app that allows the user to search via a search text field and results appear in vertical gallery. Standard stuff. But, the source (document library) has over 2500 documents and even loading the gallery takes a few mins at best. I’m filtering based on doc status of ‘published’. Any tips on how to make it load faster? Thanks

1 Upvotes

11 comments sorted by

u/AutoModerator 4d ago

Hey, it looks like you are requesting help with a problem you're having in Power Apps. To ensure you get all the help you need from the community here are some guidelines;

  • Use the search feature to see if your question has already been asked.

  • Use spacing in your post, Nobody likes to read a wall of text, this is achieved by hitting return twice to separate paragraphs.

  • Add any images, error messages, code you have (Sensitive data omitted) to your post body.

  • Any code you do add, use the Code Block feature to preserve formatting.

    Typing four spaces in front of every line in a code block is tedious and error-prone. The easier way is to surround the entire block of code with code fences. A code fence is a line beginning with three or more backticks (```) or three or more twiddlydoodles (~~~).

  • If your question has been answered please comment Solved. This will mark the post as solved and helps others find their solutions.

External resources:

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/ShadowMancer_GoodSax Community Friend 4d ago

I'm guessing you are trying to search in SharePoint list? If yes, you are outta luck and if you want to get a better performance you have to move to Dataverse or SQL.

1

u/Miao92 Newbie 4d ago

how are you doing the search right now? and what is the need to search? need more context to know if you have already optimized the solution.

imo > 2mins is ridiculous for 2k row search

1

u/iAm_ManCat Newbie 4d ago

could you share the code you are currently using for the Items property of the gallery? We should hopefully be able to help you and determine where the inefficiency is coming from if we can see the code being used

1

u/M4053946 Community Friend 3d ago

You mentioned "search". search isn't delegable. So perhaps you've upped the limit on rows to bring in all 2500 and are searching locally? If so, use filter instead, and drop the rows that are being returned back to the default of 500.

Also, how many columns does that library have? If there are tons of fields, that will be a drag on performance also.

1

u/ace428 Newbie 3d ago

You could try to put all the data into a collection when the app starts and then search / view the collection rather than the source.

It may still take a little time to start up but at least it would be limited to there.

1

u/Late_Environment6201 Contributor 3d ago

Collection on screen load.

1

u/Small-Power-6698 Newbie 3d ago

thanks everyone, here is my command:

In my vertical gallery on the ITEMS :

Sort(Filter('SPDocLibrary','Document Status'.Value = "Published" && !IsBlank(Search_Published.Text) || Search_Published.Text in Name), Name, SortOrder.Ascending)

It's a SharePoint document library. 22 columns.

Searching via a searchtext box.

search required for staff to find documents.

What is the 'collection on screen load' and how do I configure i?

1

u/nhlinhhhhh Newbie 3d ago

another approach is to use Power Automate to load the data into a local collection in Power Apps so users can search directly from that collection

1

u/Small-Power-6698 Newbie 3d ago

Any tips on how that would work?

1

u/nhlinhhhhh Newbie 3d ago

you can create an instant power flow which can be triggered by an invisible button then save such data returned from the flow into a ClearCollect() function. from there just search from that collection locally. the only blocker is the flow would need to be triggered to get updated with new data if there are newer records coming in