Hello everyone,
What i am trying to do is the following. i have a start screen with many buttons that lead to another screen which has a gallery that holds my data items. But based on the buttons on the start screen, each one should filter out my gallery accordingly, how can i do this.
thank you
Solved! Go to Solution.
It can, yes.
If you're just substituting different values into the "StartsWith" construction, you just have to pass different variables.
On the other hand, if your actual filter criteria changes, you will need:
...1) different Filter() statements referencing
...2) different Context Variables, and...
...3) another Context Variable that tells the Gallery which Filter statement to apply (let's call it: whichFilter)
Then, each button will have to pass the right variables in their Navigate() statement, AND they will have to pass the whichFilter variable.
Your Items property would then include an If() statement:
If ( whichFilter = "Button1", // Button1 sent us to this form and filled the variables Filter(...), // filter using Button1's variables whichFilter = "Button2", // Button2 sent us to this form and filled the variables Filter(...), // filter using Button2's variables Filter(...) // default case, Button3 sent us and we'll use those variables )
Depending on how many cases you had to test for, a Switch() statement might simplify that.
Hello @mmattar,
The following should work:
1. Use the following formula for your Gallery (paste it into gallerie's Items property): Filter(CustomGallerySample, SampleHeading=filterCriteria)
2. Use the following parameter with your Navigate command (paste the formula into button's OnSelect property):
Navigate(Screen1, ScreenTransition.Cover, {filterCriteria:"Lorem ipsum 1"})
just so im understanding correctly, here is my formula that i put into my galleries items.
SortByColumns(Filter(TRACAgenda,StartsWith(mlpo.DisplayName,TextInput1.Text)||StartsWith(o0fc,TextInput1.Text)),"TRACMeetingDate",If(sortDescending1,Descending,Ascending))
Now on my start screen where i have my button, i have: (i left out the sorting in the filter because it is giving me error, i believe because i am decalring a variable on the gallery screen and not the start screen.
Navigate(TracInitiative,ScreenTransition.Cover,{filtercriteria: Filter(TRACAgenda,StartsWith(mlpo.DisplayName,TextInput1.Text)||StartsWith(o0fc,TextInput1.Text))})
Your Items property on the Gallery would be:
Filter(TRACAgenda,StartsWith(mlpo.DisplayName,filterCriteria)||StartsWith(o0fc,filterCriteria))
And your Navigate statement would only pass the TextInput1.Text as the variable:
Navigate(TracInitiative,ScreenTransition.Cover,{filterCriteria: TextInput1.Text})
If, for whatever reason, you wanted a different variable in your second filter criteria, just have 2 variables, and then pass those 2. Let's say the second "StartsWith" parameter came from another TextInput, this one named "TextInput2". Your Items would read:
Filter(TRACAgenda,StartsWith(mlpo.DisplayName,filterCriteria1)||StartsWith(o0fc,filterCriteria2))
And your Navigate statement would pass both variables:
Navigate(TracInitiative,ScreenTransition.Cover,{filterCriteria1: TextInput1.Text, filterCriteria2: TextInput2.Text})
ok thanks! but what if i have another button that does a different filter, i want to use the same gallery. does the items property in the gallery change ?
It can, yes.
If you're just substituting different values into the "StartsWith" construction, you just have to pass different variables.
On the other hand, if your actual filter criteria changes, you will need:
...1) different Filter() statements referencing
...2) different Context Variables, and...
...3) another Context Variable that tells the Gallery which Filter statement to apply (let's call it: whichFilter)
Then, each button will have to pass the right variables in their Navigate() statement, AND they will have to pass the whichFilter variable.
Your Items property would then include an If() statement:
If ( whichFilter = "Button1", // Button1 sent us to this form and filled the variables Filter(...), // filter using Button1's variables whichFilter = "Button2", // Button2 sent us to this form and filled the variables Filter(...), // filter using Button2's variables Filter(...) // default case, Button3 sent us and we'll use those variables )
Depending on how many cases you had to test for, a Switch() statement might simplify that.
Bam! thats what i needed, thanks !
User | Count |
---|---|
183 | |
123 | |
88 | |
45 | |
42 |
User | Count |
---|---|
251 | |
160 | |
126 | |
78 | |
73 |