cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
caltmiks
Frequent Visitor

Overcoming Delegation Issues with Filter then Search

Hello and thank you in advance for any assistance. I am relatively new to the Power Platform and have encountered an issue with delegation. This question is about Power Apps but if anyone has advice on how to change something within the SharePoint list to make the two work together better I am all ears.

 

The situation:

1) I have a Sharepoint list with over 3000 items. Out of that list only about 1200 are relevant but I can't remove the rest because we have to keep historic data.

2) I am trying to first perform a filter using StartsWith to bring back a smaller data set which will be well within the delegation limits.

3) Using the smaller data set from the filter I would like to perform a search on 3 different columns of information.

 

caltmiks_0-1645560391116.png

Either line of the formula will work on its own. The Filter does not have delegation issues whereas the Search does have delegation issues.

Is there a way to combine this and perform the Filter first then the search?

 

I was planning to hide the text box with 2920 after the app is complete so users would only interact with search. Essentially using the text box to set a filter variable.

 

The second part of this issue which I don't know if I can solve in PowerApps is I have a dropdown for Archive which has the options "Yes, No, NA". Can I filter and return back only records that have 2920 as CompanyCode and Archive as No? Currently it would recognize filtering Archive as No if I change that for company code as I believe it is a drop down box and not text. Thinking I may have to create another column in SharePoint to take the dropdown box value and convert it to text?

 

This is what I was working on and couldn't get it to work with using just filters.

Filter(CorpAVLV2, StartsWith(VendorName, Trim(TextInput1.Text), Or StartsWith(BPNumber, Trim(TextInput1.Text), StartsWith(ScopeMatrix, Trim(TextInput1.Text)) And CompanyCode = “2920”)

 

The problem is the VendorName, BPNumber, and ScopeMatrix would ideally not be limited by StartsWith, also the And CompanyCode = "2920" should have a second And Archive = "No".

 

Hopefully this is not too confusing to follow. I have watched about 3 hours of YouTube videos and it seems that multiple drop downs can be used to reduce the size of data then from there a filter used on a text box input. The level of difficulty on that seems very high so I was hoping it was be easier to go with simply filtering by 2 set values to reduce the data set size to a searchable range.

 

Thank you.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@caltmiks 

The key to this is your #1 statement - only about 1200 of the records are relevant.

So, what you would want to do is pre-filter the list to get the records that are relevant and then perform all the other operations against that list.

 

So take what is delegable in your pre-filter and then perform the non-delegable against that would be a formula such as this:

With({_preFilter: 
    Filter(CorpAVLV2, CompanyCode = "2920" && Archive = "No")
    },

   Search(_preFilter,
        Trim(TextInput1.Text), "VendorName", "BPNumber", "ScopeMatrix"
   )
)

The above formula is delegable and will give you what you are looking for.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

11 REPLIES 11

There are several ways to delegate, personally when working with large datasets that will need several searches run on them, in first step I will run a clearcollect(filter( on whatever column will get that datasource trimmed down the most and then run everything else off that collection. That being said I tend to use PowerAutomate running scheduled cleanups nightly to move things that are no longer relevant to a historical archive version of the sp list so that we are able to maintain a data trail and also keep a trim datasource.

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

@caltmiks 

The key to this is your #1 statement - only about 1200 of the records are relevant.

So, what you would want to do is pre-filter the list to get the records that are relevant and then perform all the other operations against that list.

 

So take what is delegable in your pre-filter and then perform the non-delegable against that would be a formula such as this:

With({_preFilter: 
    Filter(CorpAVLV2, CompanyCode = "2920" && Archive = "No")
    },

   Search(_preFilter,
        Trim(TextInput1.Text), "VendorName", "BPNumber", "ScopeMatrix"
   )
)

The above formula is delegable and will give you what you are looking for.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

My original solution to overcome this issue when I was planning was to take the original list with all records and break it into 5 smaller lists which are connected to different galleries. Then the original list would be updated from the source of truth in SAP and cascade down to the 5 smaller lists. I was told to use views to break things up.

 

I now have 5 views on the SharePoint list which return the filtered data I want. Doing a bunch of reading it looks like being able to connect a gallery to a SharePoint list view is a very requested feature that has not been implemented yet.

 

I can make this work using Excel sheets, but that's not really a good solution to rollout for several reasons. Maybe I am examining the problem from the wrong lens and I should return to my old idea of breaking the large dataset into multiple Sharepoint lists then connecting them in that manner. I understand the basics of Power Automate but will have to brush up on skills and do some testing to break a list up.

@caltmiks 

The prefilter I mentioned should work just fine with SharePoint.  

Yes, you cannot use a view from SharePoint in your app.

Try and avoid bringing all of your records into your app when you can delegate some of the criteria as this will just overload the app memory and performance will suffer - this includes Galleries!  Note, Galleries work much different than other controls and you might find in many cases that the gallery will NOT have all the records in it that you expect.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes thank you for the response and I am pretty sure this is close and I am just missing something simple now. I am still getting some errors when I use that formula.

 

I suspect they may be coming from a couple places.

1) I switched the Archive to QMSSupplier instead. The columns in the SP list are the same except that QMS returns a smaller more relevant number of records. That column is not a simple Boolean choice it is a dropdown select box with Yes, No, and NA. Not sure if a dropdown box can be compared as "Text"?

2) The ScopeMatrix is also a dropdown multiselect which can be 1 or more of over 30 choices. I suspect that will not return anything because of the .Text search.

 

These are the errors I am getting:

caltmiks_0-1645565140936.png

If I remove the && QMSSupplier = "Yes" the filter seems to not have any errors but by itself does not return records. The second part with the Search comes back with the following error:

caltmiks_2-1645565575102.png

 

VendorName exists in the SP list and I have even copy and pasted it directly from the list to make sure something wasn't missed. Intellisense does not pickup any of the columns from the SP list. I tried removing the ScopeMatrix portion but I get the same error still.

 

Even breaking it down to the bare minimum the Search portion the Search argument is not working.

 

Maybe I am inserting this formula into the wrong location? I am putting it in the Items on the applicable gallery.

 

Curiosity, could the filter function be used on the App OnStart then just call to the _preFilter on the gallery?

 

Thank you very much for the assistance. This is my first business process app for a real world application to provide context to my very rudimentary understanding. I have done a few practice apps from courses on Udemy but those tend to be straight forward and don't run into significant issues.

I spend about 4 or 5 hours trying to use the _preFilter solution and could not get it to work.

I ended up going back to the drawing board and watching some more Youtube videos based on delegation limits and ended with with the following:

caltmiks_0-1645721975090.png

I created a filter based on a dropdown box that I set default to what I wanted to show and hid that box. I then filtered by the organization. With those 2 filters the data was reduced to just under 300 items which is searchable. I do still have a delegation warning on the search portion because "in" is not delegable. To get around this causing issues later the property on the search box for visible is set so search will disappear if the delegation limit is reached.

Its probably not the most elegant solution, but its working and considering its my first production app I will run with it.

@caltmiks 

Your formula will produce delegation warnings using the in operator.

The formula I provided in message #3 should be what to use.  

If you are getting incompatible type errors on that formula, then what kind of columns are you trying to search?  They all need to be Text columns.  Are they something different?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

As I have worked on this app and built more of a knowledge base and solved a couple other issues I was able to understand your original solution. When I first tried using it I spent a lot of time trying to get it working without luck but there were a few pieces in my base level of understanding missing.

ha_wai
Helper III
Helper III

Hi there,

 

as I am facing a similar problem, I just add to this thread in the hope to get an answer.

 

I made the mistake of using yes/no columns in my SP list before I learned about the delegation problem with the true/false and 0/1 "feature" The project is a prospective data collection and people have started contributing, hence it is rather unpleasant to change the SP list to work around that.

 

The dataset is growing by about 50 records per month so I need a solution pretty soon. But luckily for the purpose of the app those flags are only really used on the latest 6 weeks of data. I currently have a generic search and filter screen that is used for all kinds of filters.

 

My basic question is: in which order does the filter function work through the statements? Meaning would it work to filter for the relevant date range and then for presence of the flag in the same filter statement or would I have to nest them somehow?

 

Current Items property of the gallery:

Filter(
retrievaldata,
IsBlank(cvar_filter_mode) || mode.Value = cvar_filter_mode,
IsBlank(cvar_rv_select) || rv_flag = cvar_rv_select, //all boolean filters have a delegation problem, needs fixing before >500records
IsBlank(cvar_mm_select) || 'm&m_flag' = cvar_mm_select,
IsBlank(Search_NHI.Text) || NHI = Search_NHI.Text,
IsBlank(Search_name.Text) || PatName = Search_name.Text,
IsBlank(cvar_filter_doc) || doc.Value = cvar_filter_doc Or doc_buddy.Value = cvar_filter_doc,
IsBlank(cvar_filter_nrs) || nurse.Value = cvar_filter_nrs Or nrs_buddy.Value = cvar_filter_nrs,
IsBlank(cvar_filter_date_start) || dpt_TPWO >= cvar_filter_date_start,
IsBlank(cvar_filter_date_end) || dpt_TPWO < DateAdd(date_end.SelectedDate, 1, Days)
)

 

Would it simply work if I were to move the time frame ones to the top?

 

Cheers

Hansjoerg

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,062)