I have a gallery where I want to filter based on a variable.
CollectionA table looks like this.
| ID | Name | Created By |
| 3 | TestA | TestB |
| 31 | TestAB | TestBA |
I have created a dropdown to filter the gallery based on ID.
ClearCollect(colCampID,AddColumns(ShowColumns(DataSource, "ID"),"IDText", Text(ID)), {IDText: "Any"});
ClearCollect(colName,AddColumns(ShowColumns(DataSource, "Person"),"Name", Person), {Name: "Any"});
ClearCollect(colCreatedBy,AddColumns(ShowColumns(CampaignCentral, "Author"),"CreatedBy", Author.DisplayName), {CreatedBy: "Any"});colCampID looks like this now:
| IDText |
| 3 |
| 31 |
| Any |
I am using colCampID.IDText as a dropdown values to filter.
I have several similar filters on Name and Created By as well and using collection colName and colCreatedBy for items for dropdown.
I have created a local variable on change of all the dropdown.
On Change of ID Dropdown:
UpdateContext({varFilterID: If(Self.Selected.IDText = "Any", Blank()& "in Text('ID')", "Dropdown1.Selected.IDText = Text('ID')") })
On Change of Name Dropdown:
UpdateContext({varFilterName: If(Self.Selected.Value = "Any", Blank()& "in Name", "Dropdown1_1.Selected.Value= Name") })
On Change of Created By Dropdown:
UpdateContext({varFilterCreatedBy: If(Self.Selected.Value = "Any", Blank()& "in 'Created By'", "Dropdown1_2.Selected.Value= 'Created By'") })
All three conditions needs to be applied.
So basically if "Any" is selected in a dropdown then get all records else get that specific record.
Currently my Gallery Items is as follows:
Filter(CollectionA , varFilterID,varFilterName, varFilterCreatedBy)
This is not working for me. Can you please help?

Report
All responses (
Answers (