Hi Guys,
I am new to Powerapps and wanted to create a tool where I have 6 different buttons for each team based on the selection it will filter my gallery.
I have created for each button onselect:
UpdateContext({FilterATeam:!FilterATeam})
UpdateContext({FilterBTeam:!FilterBTeam})
UpdateContext({FilterCTeam:!FilterCTeam})
UpdateContext({FilterDTeam:!FilterDTeam})
etc
When It comes to write the formula in the gallery I tried something like Filter(MySP,If(FilterAteam=true,Title="Ateam",false)) but I don't know how could I add the rest of the updatecontext formulas in the gallery together.
Thank you for the help
You can do a crazy nested If Function, but I think this is easier an cleaner. If you don't like it, I can help you write the nested If Funtion. I'm new at this too, so check my syntax!
Use ONE Context Variable - so for each button's onselect:
Button for Team A: UpdateContext({cvarteamtofilter:TeamA})
Button for Team B: UpdateContext({cvarteamtofilter:TeamB})
Button for Team C: UpdateContext({cvarteamtofilter:TeamC})
Button for Team 😧 UpdateContext({cvarteamtofilter:TeamD})
Then on your Gallery Items
Filter(Sparepointlistname,Spharepointlistcolumn,
Switch(cvarteamtofilter
TeamA, "Team A",
TeamB, "Team B",
TeamC, "Team C",
TeamD, "Team D"
))
This is saying filter this sharepoint list's column based on the value of the context variable.
Switch(contextvariablename,
"variablevalue=this", "return this value into he Filter function",
"variablevalue=that", "return this value into he Filter function",)
You can add as many things to switch the output value as you have option
Again, I am new - so my question, or where I will have to play with it - I'm not sure if the context variable values have to be in quotes.
Seriously, I am working through a similar scenario, so I as I do, I'm seeing other things that need to be set.
On the form's onvisable property, set the context variable to something else, maybe "AllTeams". and add this to your switch funtion inputs/outputs to filter by all too.
User | Count |
---|---|
198 | |
123 | |
85 | |
50 | |
42 |
User | Count |
---|---|
284 | |
159 | |
134 | |
73 | |
72 |