PowerApps Delegation & Gallery Filtering using multi select Choice and Lookup Columns (Part 4)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody my name is razzle Durrani and this is part four of my delegation video series this one is going to be on multi select column so how do i filter my galleries based on multi select columns so in our use case for the students list which has 295 items as you can see I have a column called subjects which is of type multi choice it is a choice field multi select it could also be a lookup field multi select the concept for both of them for both of them will be the same so how do I work with multi fields now if you look at delegation operations again choice fields falls under the complex category but multi select means an array or a collection of complex items so technically can I use a filter operation on my gallery using the multi select column let's find out so if I look at the items property it's showing me information of all the students right and if I want to filter now first thing is I need all the subject information and subject is a choice field so if I go to my students list and if I go to the settings for my list we will look at students I'm sorry it's subjects the subjects column it's a choice field in my students list and I have the choices defined and yes it's a lot multiple selection so if I head back to my power app I just added a filter criteria on the top which loads from a collection and how do I load this collection on start of the app I have a very simple statement called clear collect I created a collection by using the choices function and I am using the students list and the subjects column so it's giving me a collection of all the subjects that have been chosen as choices which is right here perfect match English social studies now if I head back to my drop-down yes it's getting collected from that collection which is exactly what I want now in order for me to filter this if I try further students where the subjects right subjects start again it's a complex type field value is equal to and this drop-down is let's rename those two DRP subjects okay and so filter this where subjects dot value is dropped on subjects not selected toward value now if it was a single field lookup column if it was a regular choice column or a single select lookup column this would work in this case it's a multi select choice column so as you can see first of all there's a delegation warning second it says invalid argument type that's because subjects dot value is going to be me a collection of values even though there's one item selected it's a multi-select field right there could be one item two item three items select multiple subjects which a student can select it's um both eyes on a choice field so this is not going to work so basically I cannot use the filter operation so what do I do in this case alright so I change my gallery back to items first thing let's try and see what is the value in that column so if I try and add a simple label a text a label field in my gallery and if I try and use this item dot subjects dot value if you notice even this errors out because the return type is a table it's a collection right now how do I get the individual values from of the subjects for this particular item for that you would have to use the concatenation function so I'm saying concatenate the values that you get get the value and just Porter comma after the value and concatenate these right so all I'm saying is this item does subjects or value get the value and concatenated with as in you get the value add a comma to it and this will run concat this entire thing right concatenate these values with this right but the item that's obtained from that cable and this now if I play the app if you notice let me try and increase the length of this field and if I play this as you can see I have multiple subjects that students have selected science English math science English social studies and so and so forth now yeah I know there's a comma at the end we can we can write logic in there it says truncate or we can use left right functions and remove the last common that's not a problem so the point being that this is a table now how do I show and hide or how do I filter my results based on the subject that's selected on the top now one way of using filter operation would be I could do I could do starts with or use the in operator these work with collections so if I do filter students where the subjects dot value right so I can set filter students where the subjects dot value or where the drop-down subjects dot selected dot value because this will always have one values from my drop-down is in a collection right in which collection subjects dot value this will not error out but it gives me a delegation warning that means I have no option here I'm stuck I'm stuck with delegation again and in is not a delicate operation right if I go back here and if I search for the in operator in this doc store microsoft.com for delegation which happened data source in is not ineligible operation so now what do I do in is not going to work right that is so this so this is not going to work for me right an option is out how do i filter this so the trick here lies in not filtering it but rather than that showing and hiding the items on the gallery yes so it will load everything right and it will respect delegation but we will only show and hide items depending upon what is selected so how do I do this here's my gallery if I edit my gallery item if you notice I have all these fields in it and I want to show and hide all the fields so first thing what I'm going to do is I'm going to group all of these items together and for the group I am going to use the visible property of the group and this property I am going to set to this so what this is saying is if the drop-down subjects that selected or value that's this drop-down if the subject that's here is in this item dot subject stored value that means for the current item if this exists on the subjects array then show the value else hide the value so now if I play this app as you can see subject mats if there is mats in it it will get it if I use subject signs and this could be anywhere in that collection right if I change this to from mats to science as you can see it's getting me science right even though it's at position one position two so and so forth so it works but why do I have these gaps well that's because I'm just doing showing and hiding and my gallery is not is not a flexible height gallery so how do I do that well I cannot be using this brow scaler E and instead what I'm going to do is I'm going to use another kind of gallery called the flexible hide gallery wherein the height automatically adjusts itself based on the values were then it being visible or not so if nothing's visible it will automatically shrink the height so let's use a blank flexible height gallery now and we can replace the gallery right here and in this gallery we are going to add different labels right so label obviously the gallery is gonna come from the students collection the first label is the name of the student the second label is the region which the student belongs to it's a choice field so I have to use region dot value and then let's say sorry and then let's say I want to show the subjects I am going to do this item again we're gonna do the concat operation if you remember same thing this item dot subjects not value value ampersand come on okay so I got my subjects in here great now this is a flexible height gallery for the gallery if you look at padding it's set to five and if you look at template Phil I'm just gonna make it look like previous one okay so here's my gallery again I can add more elements to this in this case again I'm gonna go ahead and group my items same concept and this time I am gonna use the same visible property and the visibility is again the same concept if the sub the drop down drop selected value is in this item tour subjects and value then show it as hide it now if I play this app if you notice there are no empty spaces why because the flexible hide galleries hand handling that for me so now if I pick English I'm going to get all English if I pick mats it's going to show me so I pick mats it's going to show me all the students who have chosen mats as a subject so as you can see flexible height gallery works although form a user perspective he's filtering but in reality we are just showing and hiding items on the gallery that's because there's no way to filter this without running into the delegation ratio in this case there's no delegation because I'm directly connecting to my data source and I can straight away just go and show and hide items and it works great now let's take this one level higher okay this works great but what if I want to choose multiple subjects right because it's a multi-select field so now I am going to change this control to a combo box we replace the combobox right here next to the subjects and I'm gonna fill this with the same collection that I that I have which is the collection of subjects if I play this I have math science English now I can pick multiple subjects so maybe show me everything red it does mats or English we can do ours we can do ends I'll show you how and this time if I go back to the group and if I look at the firstly let's name this combo box you're gonna call the combo subjects okay copy this now if you go back to group five and if we go to the visible property for this we are going to change this to a function so I've already pre written this function I walk through this function right now just going to change it to this okay now what did we change this to let's go back to visible right on top so we can see the visible property let's change this to visible and let's look at the function so in this function what I'm saying is for all combo box so that's my combo box got selected items dot value that is for every selected item dot value of my combo box if the value so it's like a for each loop right here if the value is in okay this items I need to change this to the side two dot subjects dot value so for the current item if it is in the cut so if the loop item is in the current list of subjects put the value yes else put the value no and all of this again I'm using the same concatenate function so this is going to concatenate and going to give me the results the results are going to be yes yes no no depending on whether the subject matches or not and I'll show you what the value is in a label as well and all I'm trying to see is is yes in this collection of what is yes a part of this label so I'll show you how so let's say out here okay first let's see how this works so if I play this I've picked mats in English it's an or operation so this one has English it's going to show up this one has mats it shows up this has English it shows up so it's a combination if I just make social study and let's say I pick Matt it's just gonna give me Matt's and social studies you see so it's doing an otter operation there you go all right so now a user can multi-select from a combo box and it's going to work and also I said I'm going to show you how the value is being populated so instead of using the so let's edit this again and let's break which label it's big the this label and instead of using this item dot regions dot value what they are going to do is we're going to get the visible property let's go to the second label and change this to this okay now if I play the app you see social studies and math it's forced checking to see if social studies on that it says no it's Matt's in there it says yes right in this one yes I don't know yes I don't know any yes so it's trying to just check to see if yes is in this if yes if the word years exists it's an or operation it works and we can write some logic to handle and as well so as you can see it works really well oh yes we had to use the flexible gallery because we wanted the we wanted to hide all the elements of the item because they couldn't filter and that's how multi choice fields filtering option can work with a gallery width delegation as you saw thank you so much for watching part four of my delegation series do subscribe to my channel I'll be uploading a lot more videos in future also post comments about what other topics you would like to cover I'm actually just looking at the community forums and delegation was one of the most frequently asked questions about in terms of how do i further how do i oh I know I'm running into delegation issues choice fields lookup fields multi select fields so that's why I did this video series thank you so much for watching
Info
Channel: Reza Dorrani
Views: 26,864
Rating: 4.9395771 out of 5
Keywords: powerapps filter multiple choice column, powerapps filter multi select, powerapps filter multiple values, powerapps delegation, powerapps delegation sharepoint, powerapps delegation workaround, powerapps delegation warning filter, powerapps delegable functions, powerapps delegation in operator, powerapps delegation filter sharepoint, powerapps filter gallery multiple values, microsoft powerapps, powerapps, power apps, powerapps gallery filter
Id: 44j2VRbdWjk
Channel Id: undefined
Length: 15min 10sec (910 seconds)
Published: Fri Sep 13 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.