Is it possible to automatically deselect the most recently selected item in a List Box based on a formula? For example, I want to deselect an item if it already exists in a collection.
Solved! Go to Solution.
Hi@pwrappr01,
Based on the issue that you mentioned, do you want to make the most recently selected item deselect in the Listbox if it already exists in a collection?
Could you please share more about your Listbox, is it multiple selections allowed or not?
Set the OnChange property as below
If(!IsEmpty(Filter(Test3,Country1 in tem2.Country)),Reset(ListBox1))
Actually, it canโt be achieved that you want to automatically deselect the most recently selected item in a List Box. The final result shown in Listbox is a table, however, you can only have one default selected item in the Default property of the Combo Box. If you need multiple selected items please use the Combo Box control. Whatโs more, Combo Box canโt automatically deselect, youโd better add a button to achieve this.
First I create a collection tem2 to save every selected item in the ComboBox. Then there is a collection named Test3 to check if the most recently selected items have existed in it, if it does, remove it from the tem2. By putting tem2 into the DefaultSelectedItems property, the ComboBox will show as you expect
I have a Collection named Temp filled in the Combo Box which you can see as below:
Collect(Temp,{Country:"China"},{Country:"Korea"},{Country:"Japan"},{Country:"Thailand"})โ
Collect(Test3,{Country1:"Korea"},{Country1:"Canada"})โ
ClearCollect(tem2,ComboBox1.SelectedItems);If(!IsEmpty(Filter(Test3,Country1 in tem2.Country)),Remove(tem2,ComboBox1.Selected))โ
Reset(ComboBox1)โ
tem2โ
Best Regards,
Qi
On the Items of the listbox try:
Filter(Datasource,Not(Column in CollectionName.Column))
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Hi@pwrappr01,
Based on the issue that you mentioned, do you want to make the most recently selected item deselect in the Listbox if it already exists in a collection?
Could you please share more about your Listbox, is it multiple selections allowed or not?
Set the OnChange property as below
If(!IsEmpty(Filter(Test3,Country1 in tem2.Country)),Reset(ListBox1))
Actually, it canโt be achieved that you want to automatically deselect the most recently selected item in a List Box. The final result shown in Listbox is a table, however, you can only have one default selected item in the Default property of the Combo Box. If you need multiple selected items please use the Combo Box control. Whatโs more, Combo Box canโt automatically deselect, youโd better add a button to achieve this.
First I create a collection tem2 to save every selected item in the ComboBox. Then there is a collection named Test3 to check if the most recently selected items have existed in it, if it does, remove it from the tem2. By putting tem2 into the DefaultSelectedItems property, the ComboBox will show as you expect
I have a Collection named Temp filled in the Combo Box which you can see as below:
Collect(Temp,{Country:"China"},{Country:"Korea"},{Country:"Japan"},{Country:"Thailand"})โ
Collect(Test3,{Country1:"Korea"},{Country1:"Canada"})โ
ClearCollect(tem2,ComboBox1.SelectedItems);If(!IsEmpty(Filter(Test3,Country1 in tem2.Country)),Remove(tem2,ComboBox1.Selected))โ
Reset(ComboBox1)โ
tem2โ
Best Regards,
Qi
User | Count |
---|---|
195 | |
126 | |
91 | |
48 | |
44 |
User | Count |
---|---|
280 | |
163 | |
138 | |
81 | |
76 |