Hi,
I try to create a tool to filter gallery with choices column.
Here is my dataverse table:
Here are my settings:
table name: 'Tasks Infos'
combobox name: subtasksFilter
subtasksFilter items: Choices('Tasks Infos'.Subtasks)
gallery items:
Filter('Tasks Infos'; Concat(subtasksFilter.SelectedItems; Value & ",") in Concat(Subtasks; Value & ","))
I used this solution but it doesn't work perfectly. Items are hidden when filter is not enabled and doesn't work properly when combobox selection has wrong order. Here is what it looks like:
I would assume that by selecting 1, 3 gallery displays:
What is wrong with this formula? I tried before with Sharepoint list with choice that allow multiple selections but it works the same and also I read that sharepoint list has more limitation and dataverse is the database that I should use.
Solved! Go to Solution.
I found a solution in this video. It works but it is not ideal. It forces to use single line text as a source and not choices. Adding additional combobox makes the function looks like spaghetti.
I put here a code for others:
App OnStart:
ClearCollect( colItems, TestList2 ); ClearCollect( colOptions, RenameColumns( AddColumns( ["dog", "chicken", "pet", "boswell", "young"], "IsChoosen", true ), "Value", "OptionName" ) );
ComboBox1_2 Items:
colOptions
Reset icon OnSelect:
ClearCollect(colYourItems, colItems); Reset(ComboBox1_2);
Filter button OnSelect:
// diselect all options UpdateIf(colOptions, true, {IsChoosen: false}); // change IsChoosen to true for selected items from combobox ForAll( ComboBox1_2.SelectedItems As _item, If(_item in colOptions, Patch(colOptions, _item, {IsChoosen: true})) ); // create empty collection that match exact Clear(colItemsToShowExact); // add items to exact collection based on IsChoosen ForAll( Filter( colOptions, IsChoosen ) As FilterChoices, Collect( colItemsToShowExact, Filter( colItems, FilterChoices.OptionName in ItemType ) ) ); // remove duplicated items from exact collection ClearCollect( colYourItems, Filter( GroupBy( colItemsToShowExact, "ItemName", "ItemType", "Color", "DATA" ), CountRows(DATA) = CountRows( Filter( colOptions, IsChoosen ) ) ) );
Gallery Items:
colYourItems
I think the problem is in your concat
Concat(subtasksFilter.SelectedItems; Value & ",")
This will make "new1, new 2, new 3"
A filter does not work like that
Filter(Source; task = Dropdown.Selecteditem)
Not sure if thats why.. But I never saw a filter like yours... You dont have the "logic test"
This formula gives an error: wrong comparison type.
Filter('Tasks Infos'; Subtasks = subtasksFilter.SelectedItems)
After the selected items you need to put .Value
And I am not sure if it will work for many items, as I said before
I found a solution in this video. It works but it is not ideal. It forces to use single line text as a source and not choices. Adding additional combobox makes the function looks like spaghetti.
I put here a code for others:
App OnStart:
ClearCollect( colItems, TestList2 ); ClearCollect( colOptions, RenameColumns( AddColumns( ["dog", "chicken", "pet", "boswell", "young"], "IsChoosen", true ), "Value", "OptionName" ) );
ComboBox1_2 Items:
colOptions
Reset icon OnSelect:
ClearCollect(colYourItems, colItems); Reset(ComboBox1_2);
Filter button OnSelect:
// diselect all options UpdateIf(colOptions, true, {IsChoosen: false}); // change IsChoosen to true for selected items from combobox ForAll( ComboBox1_2.SelectedItems As _item, If(_item in colOptions, Patch(colOptions, _item, {IsChoosen: true})) ); // create empty collection that match exact Clear(colItemsToShowExact); // add items to exact collection based on IsChoosen ForAll( Filter( colOptions, IsChoosen ) As FilterChoices, Collect( colItemsToShowExact, Filter( colItems, FilterChoices.OptionName in ItemType ) ) ); // remove duplicated items from exact collection ClearCollect( colYourItems, Filter( GroupBy( colItemsToShowExact, "ItemName", "ItemType", "Color", "DATA" ), CountRows(DATA) = CountRows( Filter( colOptions, IsChoosen ) ) ) );
Gallery Items:
colYourItems
Please check out this discussion for a simple answer Re: Using a combobox to filter choices column - Power Platform Community (microsoft.com)
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
188 | |
53 | |
50 | |
34 | |
33 |
User | Count |
---|---|
267 | |
92 | |
78 | |
68 | |
67 |