cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SeanTambling
Level: Powered On

Need help with filter on Gallery to try and eliminate delegation warning

I have an app i've been working on and you all have helped me so much. I hate to even ask for more help, but i'm stuck again.

 

I have a screen that has a gallery and the gallery needs to be filtered in many different ways. This is the current "Item" filter i have in place:

SortByColumns(Filter('[dbo].[vwGroups]', Switch(TerritoryRadio.Selected.Value,"Parent Only",IsBlank(ParentGroupID),"Child Only",!IsBlank(ParentGroupID),"All",ID) && Territory=TerritoryDrpDn.Selected.Territory, SearchBoxInputTerritory.Text in Name),"Name")

 

I get a delegation warning on the switch function. As you can see, i have 3 radio buttons. I would like to filter the gallery in 1 of 3 different ways. The filter does work, but i'm seeing some problems with it as well. One is the delegation warning. At first i didn't even worry about it. After some time, i've realized that with the switch function in, i'm missing a lot of data that i shouldn't be missing. If the "ALL" radio button is selected, i should see the entire list, but i don't. Some data is just randomly missing from the gallery. If i select child, i'll be missing random data that should be shown as a child, and the same is true if I select parent. I don't know if this is just an inherant problem with using the switch function or what. If anyone has a better way of filtering the data, and could help me, i'd be greatly appreciative.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Need help with filter on Gallery to try and eliminate delegation warning

Hi @SeanTambling 

 

Switch has to be on the outside,

Alos In is not delegable

so is IsBlank

 

try this (u might have to adjust a little)

 

Switch(TerritoryRadio.Selected.Value,"Parent Only",SortByColumns(Filter('[dbo].[vwGroups]', ParentGroupID=Blank() && Territory=TerritoryDrpDn.Selected.Territory, StartsWith(Name,SearchBoxInputTerritory.Text)),"Name"),"Child Only",SortByColumns(Filter('[dbo].[vwGroups]', ParentGroupID<>Blank()&& Territory=TerritoryDrpDn.Selected.Territory, StartsWith(Name,SearchBoxInputTerritory.Text)),"Name"),"All",SortByColumns(Filter('[dbo].[vwGroups]',Territory=TerritoryDrpDn.Selected.Territory, StartsWith(Name,SearchBoxInputTerritory.Text)),"Name")) 

 

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

6 REPLIES 6
Dual Super User
Dual Super User

Re: Need help with filter on Gallery to try and eliminate delegation warning

Hi @SeanTambling 

 

Switch has to be on the outside,

Alos In is not delegable

so is IsBlank

 

try this (u might have to adjust a little)

 

Switch(TerritoryRadio.Selected.Value,"Parent Only",SortByColumns(Filter('[dbo].[vwGroups]', ParentGroupID=Blank() && Territory=TerritoryDrpDn.Selected.Territory, StartsWith(Name,SearchBoxInputTerritory.Text)),"Name"),"Child Only",SortByColumns(Filter('[dbo].[vwGroups]', ParentGroupID<>Blank()&& Territory=TerritoryDrpDn.Selected.Territory, StartsWith(Name,SearchBoxInputTerritory.Text)),"Name"),"All",SortByColumns(Filter('[dbo].[vwGroups]',Territory=TerritoryDrpDn.Selected.Territory, StartsWith(Name,SearchBoxInputTerritory.Text)),"Name")) 

 

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

SeanTambling
Level: Powered On

Re: Need help with filter on Gallery to try and eliminate delegation warning

Your formula worked perfectly!

 

I have another gallery screen that i've tried to use basically the same formula, but I want to be able to also filter the gallery by they user. It does work but i'm getting a delegation warning. I'm fine if that is unavoidable, but just curious if the formula could be tweaked to keep from having the delegation warning.

 

Switch(MyGroupsRadio.Selected.Value,"Parent Only",SortByColumns(Filter('[dbo].[vwGroups]', User().FullName = Broker, ParentGroupID=Blank(), StartsWith(Name,SearchBoxInput_1.Text)),"Name"),"Child Only",SortByColumns(Filter('[dbo].[vwGroups]', User().FullName = Broker, ParentGroupID<>Blank(), StartsWith(Name,SearchBoxInput_1.Text)),"Name"),"All",SortByColumns(Filter('[dbo].[vwGroups]', User().FullName = Broker, StartsWith(Name,SearchBoxInput_1.Text)),"Name"))

 

The delegation warning is only underlining the red highlighted text above. Do i need to use something different than the = sign?

Dual Super User
Dual Super User

Re: Need help with filter on Gallery to try and eliminate delegation warning

Hi @SeanTambling 

 

Easy

 

On App OnStart set a variable

 

Set(varUserEmail,User().FullName)

 

Then just replace User().FullName with varUserEmail in the formula

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

 

Highlighted
SeanTambling
Level: Powered On

Re: Need help with filter on Gallery to try and eliminate delegation warning


@RezaDorrani wrote:

Hi @SeanTambling 

 

Easy

 

On App OnStart set a variable

 

Set(varUserEmail,User().FullName)

 

Then just replace User().FullName with varUserEmail in the formula

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

 


In principle, I believe that should work. When i copied and pasted that in app start, I received no errors. When i replaced 

User().FullName with varUserEmail in the formula, the gallery refreshed and then I saw the entire database. When Iadded a label and just put in the varUserEmail as the only thing in the lable, the label is blank. I tried changing the name of the variable and adding ".Text" to the end of it and ".Value" to the end of it, but nothing worked. I think this should work, but for some reason it is not. When i add a label and just add "User().FullName" (without the quotes ;D) to the label, the users full name is displayed in it. What am i doing wrong?

Dual Super User
Dual Super User

Re: Need help with filter on Gallery to try and eliminate delegation warning

Hi @SeanTambling 

 

When you add it to App on Start inorder for it to have a value you have to run the App On Start (in edit mode of App)

 

Capture.PNG

 

Right click on App node and run the on start function

 

this should ensure your variable has the value

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

SeanTambling
Level: Powered On

Re: Need help with filter on Gallery to try and eliminate delegation warning

Thank you, that worked. I had tried to run the app from the start screen, expecting that to make it work, but it didn't. I don't know why. Right clicking the app icon in the edit screen and selecting run, worked. Thank you again.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 102 members 5,366 guests
Please welcome our newest community members: