cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ungarala1
Helper V
Helper V

created different buttons to filter status & program.. when i click program button - status button not working, any solutions?


SortByColumns(
Filter(
'Tracker',
'Assigned Designer'.Email = User().Email,
IsBlank(varStatus)|| Status.Value = varStatus||varStatus="All",
IsBlank(varproject) || Program.Value = varproject|| varproject = "All"
),

"ID",
Descending
)

11 REPLIES 11
zmansuri
Super User
Super User

filters don't work on button like that. You need to set a variable on button then according to that variable a filter code will run. 

For eg.

Status button OnClick:

Set(varStatus,true);Set(varProgramme,false);

and opposite on programme button.

Then on the gallery:

 

if(varStatus,

Filter code for status,

if(varProgramme,

Filter Code for programme,

Code Withour Filter

))

data showing as delegation, so i used filter for it 

Delegation depends on Function, Operator and Column Type.

https://docs.microsoft.com/en-us/connectors/sharepointonline/#power-apps-delegable-functions-and-ope...

Not just functions.

below code will not work?

each button i used context in Onselect

UpdateContext({varStatus:"In progress"})

UpdateContext({varproject:"Project1"})

 

& gallery item code as: 

SortByColumns(
Filter(
'Tracker',
'Assigned Designer'.Email = User().Email,
IsBlank(varStatus)|| Status.Value = varStatus||varStatus="All",
IsBlank(varproject) || Program.Value = varproject|| varproject = "All"
),

"ID",
Descending
)

for debugging take a label and set it's text property as variable name to check weather you are getting correct value in the variable. Then remove all the filters in the gallery except for the User() to check the output.

Debugging is working, can u show me code without filters ( not sure which filters i need to remove from below code)

 

SortByColumns(
Filter(
'Tracker',
'Assigned Designer'.Email = User().Email,
IsBlank(varStatus)|| Status.Value = varStatus||varStatus="All",
IsBlank(varproject) || Program.Value = varproject|| varproject = "All"
),

"ID",
Descending
)

SortByColumns(
Filter(
'Tracker',
'Assigned Designer'.Email = User().Email
),
"ID",
Descending
)

where i need to keep this code then ? if we remove from gallery item,nothing is filtering

IsBlank(varStatus)|| Status.Value = varStatus||varStatus="All",
IsBlank(varproject) || Program.Value = varproject|| varproject = "All"

We are just checking if your gallery is showing any data at all. in the end You'll put this code on the gallery's item.

 

SortByColumns(
Filter(
'Tracker',
'Assigned Designer'.Email = User().Email,
Status.Value = varStatus || IsBlank(varStatus) ||varStatus="All",
Program.Value = varproject || IsBlank(varproject) ||  varproject = "All"
),
"ID",
Descending
)

 

This code looks fine if you are getting correct values in the variable.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,194)