cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
misc
Responsive Resident
Responsive Resident

Filter by dropdown, then by text search box

I've watched videos and looked at all other posts I could find about this but I'm just having no luck. Not sure what I'm doing wrong but appreciate any help.

 

I have a dropdown which should filter the gallery by the 'Report type' column (field called Reptype in the gallery), I then want the search text box to search through the other fields to narrow it down further. 

 

I can't guarantee how long the data list will be overall, and so I want to avoid using non-delegatable functions where possible, but I thought if I filter it first then do the non-delegatable search on the data returned it will be ok (there will never be over 2000 records under each report type).

 

My first hurdle is the dropdown (ReportTypeDpd) filter. I cannot get this to work at all. I have tried loads of different ways but the closest I got to anything that worked was: 

Filter(Incidents, ReportTypeDpd.Selected.Value in Reptype)

 1) This gives an error on every field in the gallery saying it's a 'circular reference' 

2) This is non-delegatable so really I want to use = or something else delegatable, but all of those threw the 'invalid argument type' error.

 

Second hurdle:

I have a search function which works by itself for the search box:

Search(Incidents, SearchBox.Text, "Title")

However if I try to add more fields to this search either as 'subtitle' or by the field name such as 'Refno' this returns blank and breaks the search altogether. Everything I found online suggested just adding the new fields should work so I have no idea why it won't eg.:

Search(Incidents, SearchBox.Text, "Title", "Refno")

  

Unsurprisingly then, when I have tried to do the full Filter/Search I get thrown errors or it just returns nothing.

gallerysort.png

I need the function to do the following:

If ReportTypeDpd = "All reports" show the full gallery

If ReportTypeDpd = "Incident Reports", "Building Reports", "Fire Reports", Filter the Gallery by the data in the 'Reptype' field

ALSO

Search all the Gallery fields (Reptype, Refno, Building, Campus, Date, Cat, Subcat) for any text typed into the SearchBox.

 

I can never get my head around the Filter/Search/Sort functions so please help! 

1 ACCEPTED SOLUTION

Accepted Solutions

I have managed to figure out the nesting Filter/Search, this below is working fine:

incidentsearch.png

My only remaining question therefore is the one about searching Choice columns - is this possible in any way?

View solution in original post

9 REPLIES 9
rsaikrishna
Community Champion
Community Champion

@misc 

 

Change your Filter function as below:

Filter(Incidents, Reptype = ReportTypeDpd.Selected.Value)

 

Reptype: This should be the field/column in Incidents data source.

 

Regarding Search function:

 

Search( Table, SearchString, Column1 [, Column2, ... ] )

  • Table - Required. Table to search.
  • SearchString - Required. The string to search for. If blank or an empty string, all records are returned.
  • Column(s) - Required. The names of columns within Table to search. Columns to search must contain text. Column names must be strings and enclosed in double quotes. However, the column names must be static and cannot be calculated with a formula. If SearchString is found within the data of any of these columns as a partial match, the full record will be returned.

 

Please check the text highlighted in bold. Make sure your Search function contains the fields accordingly.

 

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

Thanks, but neither of those seem to work.

 

For the Filter, I try it by itself and get the following. As per your suggestion I changed the 'Reptype' (name of the field box in the Powerapp) to the name of my SharePoint Column 'Report Type'. I get the error you can see, 'invalid argument type' and when I click in the function bar the = sign has a red squiggle under it.

galleryfilter.png

 

When I try the Search by itself, again it works for the basic search I mention above, but when I go to add new column names it throws an error that the column doesn't exist:

gallerysearch.png

However, as you can see from this screenshot of my list settings, it clearly does:

gallerySP.png

Your comment "Columns to search must contain text" made me wonder if it's because the column types are either Choice or Multiple lines of text, but I have tried with a column that's single line of text too with the same error.

EDIT: I have played around more and I've managed to get the 'sub-location' column to work by using 'Sub-x002d_location' instead, so I am guessing this issue is related to the fact the other columns are not text columns which is very frustrating.

 

Anything I'm missing?

 

EDIT AGAIN:
After more playing I've managed to get the Filter side working: 

If(ReportTypeDpd.Selected.Value = "All reports", Incidents, Filter(Incidents, 'Report type'.Value = ReportTypeDpd.Selected.Value))

 

So my next questions are:
1) Is there definitely no way that I can use 'Search' on a Choice column? I have tried doing .Value like I had to for Filter but no luck

2) How do I combine the Filter function above with my Search function, does the Search precede the IF or follow it?

Search(Incidents, SearchBox.Text, "Title", "Sub_x002d_location")

 

poweractivate
Most Valuable Professional
Most Valuable Professional

1) First you should start at the beginning and check this first

 


@misc wrote:

 

I can't guarantee how long the data list will be overall, and so I want to avoid using non-delegatable functions where possible, but I thought if I filter it first then do the non-delegatable search on the data returned it will be ok (there will never be over 2000 records under each report type).

 

 


 

Which do you mean?


#1A) Do you mean that a filter query from Power Apps will never return more than 2,000 records?
#1B) Or, do you mean that the total number of records, even without filters, is guaranteed always to be 2,000 or less records?

 

If you meant A, then watch out. The delegable limit applies not on the maximum filtered number of records that the non-delegable query can return, but actually applies on the total number of records,. 

 

So if you have 2,001 records, only the first 2,000 records are seen and even checked for a match, so 1 record may have a high chance to always be left out of the result altogether, even if it would have matched. If it is the 2001'th record and it matches, a non-delegable query will guarantee that it will always leave it out.

 

Consider now this example. If you have 10,000 records, only the first 2,000 records are seen, so a whopping 8,000 records may have a high chance to always be left out of the query, even if it would have matched. Suppose that only two of your 10,000 records match the filter - sure, that's below 2,000 records - however, suppose these two records are what PowerApps considers the 9998th and 9999th record. Then a non-delegable query will always skip those records, so there is a guarantee of a match of zero records every time with a non-delegable query, not the expected two records.

 

Moreover, when attempting to use a delegable query to bring it under 2,000 then use a non-delegable one after that, be very careful with that. It is possible that it will not work as expectedif even a part of the query is non-delegable.

 

Note that the default is 500 though, not 2,000. We presume you changed it to the max, of 2,000 - remember that the default is actually 500. Even if you changed it to 2,000, you should try to avoid any kind of non-delegable situation altogether.

 

Also, you want to check the connector documentation for the connector you are using. If the data source is non-delegable, no warning will show, but in that case, it is actually any use of the data source that is a gigantic "delegation warning"

 

More info on Delegation -> Understand delegation in a canvas app (docs.microsoft.com)

 

2) Regarding why suggestion from @rsaikrishna did not work in your case:

 

Actually, we are not so sure why it did not work, other than maybe Item #2B below.


This one we might have to check it further, but it may be related to your data source(s).

 

#2A) Which data source(s) is/are you using?
#2B) In the data source, does the "Sub-location" actually exist over there? Try to see if checking as the error message suggests and seeing if it may be actually missing from the data source gives any further indication of the issue.

 

Other than the above, we might need to check on it with more context and information from you.


We might come back and check through your original post in more detail to see if there was anything more that stood out. In meantime @rsaikrishna please feel free to check on it as well and possibly advise @misc of a solution.

Morning,

 

So I had thought that if I have two functions they would work one after the other so I could use a delegatable function first to definitely filter the list down to less than 2000, and then use the non-delegatable function on that smaller list. Evidently I'd misunderstood there. Having reviewed the current format however, we're only just over 1000 records for the year so would actually expect the limit of 2000 to be more than enough. 

 

In answer to your second question I am using a Sharepoint list. I actually edited my comment above with a few updates once I'd played around a little more and figured out the reason why rsaikrishna's reply didn't work - because it is a choice column I needed .Value in there after the column name.

 

With the Search, I needed to use the column name with _0200d etc. rather than just single quote marks and it worked for one of the columns which was Multiple lines of Text. It seems my issue with the Search is that I have Choice columns not text columns. Is there any way I can make this work regardless?

 

If not, I will cope with only being able to search a few of the fields (though it is frustrating), I just need to understand how to 'merge' the two.

I have managed to figure out the nesting Filter/Search, this below is working fine:

incidentsearch.png

My only remaining question therefore is the one about searching Choice columns - is this possible in any way?

Anonymous
Not applicable

@misc it's an old but a very good question. Others may find this interesting. The only way I've successfully done so (but take into account that with Search() you will always have the known delegation issue) is to add a single line of text column and populate it with the choice value via Power Automate flow. Set the trigger to 'when an item is modified', trigger condition choiceColumn.Value does not equal textColumn, if yes, update textColumn.
Now you can use "textColumn" in the list of searchable text columns.

To overcome the delegation limit, instead of Search() I use Filter(Startswith(textColumn, searchTextbox.Text)) 

did you find a way to do this dynamic??? based on the dropdownlist (use the value as a column) and the text box as a search filter? 

Jo_Leu
Frequent Visitor

Thank you! This is the answer I have been searching for!!! Amazing!

 

Two questions to follow this up:

1. Did you have a choice in the sharepoint list that said 'All Reports'? Or is there another way to make sure that's the default choice of the dropdown, and that it does indeed display all reports?

2. How do I then sort the resulting gallery items? Can I filter then by various date fields that might be in a sharepoint column (i.e. created date, 'event starting' date [which is a filed I have created in the list for a custom date value], etc.)

 

Would love to hear anything that would help me!

Morning! I'll try to answer your questions, hopefully they help:

1) I do not have a choice which says 'All Reports", my dropdown Items is manually set with "All reports" at the start, 

misc_0-1692608926561.png

and 'Default' is set to "1". 

 

2) To add a sort in, you need to use SortByColumns. This is what my formula looks like now: 

misc_1-1692608986389.png

 

SortByColumns goes around the full Filter/Search, my "Title" column is a reference number so descending means the latest shows first, you could use Created or StartDate or whatever you have here instead.

 

Hope that helps?

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 (2,222)