PowerApps Multiple Filters on Gallery

PowerApps Multiple Filters on Gallery Hello everyone this is raza dharani in today's video we will cover creating multiple filters to powerapps galleries we will look at various types of columns.

PowerApps Multiple Filters on Gallery

Choice columns multi-select choice columns text dates and we will explore how we can create these multiple filters to our powerapps galleries with respect.

To dataverse and sharepoint as a data source so let's get started with the video but first my introduction [Music].

In this scenario i have a gallery that is connected to a data source the data source in question right here is microsoft dataworks the table in.

Dataverse is a table for tasks wherein i am tracking all my task information so in powerapp now the items property of this gallery is tasks.

Info that means it's going to get me all the records from my data source now let's start applying the filters the first filter i would like to apply is on the name field which is of type.

Text in my data source so the first step is we will go and add a text input control i will remove the default property add a label called name so the user knows that.

They are filtering based on the name i have renamed the text box to txt name filter now the use case here is i would like to search based on the name that the user.

Has provided so there's a function called search so i'm going to leverage the search function and the search function as you can see intellisense is guiding.

Me through it requires the data source which is my table and then it is asking me for the text that i want to search for and in my scenario.

The text is the text control that i created dot text and finally it requires the name of the column the name of my column here the internal.

Name is crc o5 underscore name close my function and just like that i have added a very simple filter here wherein i can search based on the name.

Posts Related:

    Control which is

    Of type text so if i play the app right now and if i start searching so let's say i start searching for the word learn so it will return.

    All the items from my table where the name contains the word learn if i was to search for the word power it's going to return everything in my.

    Name field that contains the word power another way that many folks try out is use the filter function and they provide the table name and then we try and use the.

    In operator now in is not a delegateable operation so it is not delegable but the search function is delegable with respect to data works so it's very.

    Important to understand the concept of delegation and there is really good documentation on docs.microsoft.com which will explain what delegation is.

    Basically delegation means that your power app can work with large data sets you're not limited to the 500 delegation limit in power apps which can be extended to 2000.

    And there are data sources that support delegation there are three today one of them is dataworks formerly known as cds sharepoint and sql it's very important.

    When you're building the app you take into account delegation otherwise you will get false positive results in scenarios wherein your tables are large and if i go to file.

    Settings and advanced settings the number one feature right here is that delegation limit which by default is 500 it can be extended to 2000.

    You cannot spend beyond the number 2000

    Okay so i have changed my function back to using the search formula now next i would like to apply a second filter.

    And this time i would like to apply a filter on the task status column now in my table if you look at task status it is a column of type choice now for this.

    Now for this i will add a combo box now i typically prefer a combo box over a drop down purely because combo boxes have additional features where and i can.

    Actually search for items and i can even turn on multi selections if required and i've gone ahead and renamed my control to cb task status filter now for this combo.

    Box control for the items property typically what we end up doing is this we try and hard code our values in here for example my choice column for the task status has.

    These values and what we end up doing is we end up hard coding those values right here now the challenge with this is one you're hard coding second.

    Because you're creating this array with type text many times there are errors when you're trying to actually apply the filters because the data types are not matching.

    In this scenario i'm using dataverse and i'm using choice the type is an option set so if i try and map this and try and filter it will throw me an error so the better way of doing this.

    Is actually directly reading the values from your data source so i can use the choices function and pick my table and then pick my column and the moment i do this.

    If i was to play the app right now if you observe the combo box i'm getting all my values which are my choice values directly from my choice column option set so now.

    If i go back to my gallery and if i would like to add my second filter the way i would do that is this i will apply the filter function now on my data source which is tasks info.

    Pick my column which is task status is equal to my combobox control dot selected dot value and just like that if i was to go ahead and play this app.

    Now it's empty so it's not giving me anything but if i pick completed it's going to show me everything in completed status and if i pick deferred it's going to.

    Show me everything in deferred status and so and so forth now notice what happened right here i picked deferred and i picked in progress it only.

    Respected the last one that i picked if i completed it's only showing me completed although i have multiple choices here and the reason is because currently my.

    Combo box has the select multiple option to true i can turn this to false and now this will act like a drop down control when the user can only select.

    One value at a time so i have to pick only one value and that makes a lot more sense in this scenario of course we haven't handled one thing yet if this does not have any values.

    It's technically not applying any filter so i would like to show all the options and the way we can handle that is this so back to my gallery control right here we have the query which says.

    The status is equal to the selected value now what happens if my combo box is blank or my combo box is empty and the way we can add that logic in.

    Here is by adding this formula and here's the formula i'm checking to see if the combobox.selecteditems.value is blank or is the selected items in the.

    Combo box empty why am i adding these two options here well this is one of the challenges in a combo box actually if you select a value and.

    Then unselect it then the is blank function covers it initially when it is empty in that case the is empty function covers it so you.

    Have to add these two formulas in there also if you notice i have applied the or operator in between all of these functions now so basically what's going.

    To happen if the combo box is blank this is going to return true so my query is filter my data source true that means get me everything right so if it's blank it's going to get.

    Me everything or if it is empty it's going to give me everything and if it has a value both of the first conditions are going to be false and then the logic is going to fall on.

    The third condition which is my actual condition of filtering my task status column so if i play the app right now if you notice my combo box right now has.

    An empty selection so it's showing me all the records in my table if i go ahead and start selecting values it will go ahead and filter them.

    Based on the selection that i have made and let's say i go and clear my selection right here this will go back to its original state which is the empty state so it is going.

    To give me all the items in my gallery now i can replicate the same behavior for another choice column that i have in my data source in this case it's a column which is priority.

    DISCLAIMER: In this description contains affiliate links, which means that if you click on one of the product links, I'll receive a small commission. This helps support the channel and allows us to continuetomake videos like this. All Content Responsibility lies with the Channel Producer. For Download, see The Author's channel. The content of this Post was transcribed from the Channel: https://www.youtube.com/watch?v=5dSk5iOgT68
Previous Post Next Post