Hi.
I'm hoping someone cleverer than me can help.
I have a Dropdown and two Combo boxes:
DropdownSoftware_2
ComboBoxSystem_2
ComboBoxTask
The items in ComboBoxTask are gathered from the selected values of DropDownSoftware_2 and ComboBoxSystem_2
All good so far!
The issue is that I can't seem to sort the items in ComboBoxTask. I've used the following code, but the results remain unsorted. Can anyone spot where I've gone wrong?
Sort(Filter('Keystroke Library',Title=DropdownSoftware_2.SelectedText.Result And System=ComboBoxSystem_2.Selected.Result).Task,Ascending)
Can anyone spot where I've gone wrong?
Many thanks, Stuart.
Solved! Go to Solution.
Sure, I'll flag the spot you need to put a column name or something like that to sort on. I'll put Title for now:
Sort(
Filter('Keystroke Library',
Title=DropdownSoftware_2.SelectedText.Result And
System=ComboBoxSystem_2.Selected.Result
),
Title, // Switch out Title for another column to do the sorting by
Ascending
)
You can sort by different columns, so you need to define which one.
Bryan
Hi!
I sorted the issue by declaring a collection and referring to that, rather than the data source directly.
This also fixed my Delegation warning issue! Happy Days.
Thanks everyone for your help. x
Yes, you need to have a second argument in your Sort() function for the basis of sorting. This can be as simple as the column name in your filtered results on which you want to sort.
Hope that helps,
Bryan
Hi, Bryan.
I'm not sure how that code looks. Any chance you could elaborate? I'm a newbie to Power Apps so would appreciate some help.
Thanks, Stuart.
Sure, I'll flag the spot you need to put a column name or something like that to sort on. I'll put Title for now:
Sort(
Filter('Keystroke Library',
Title=DropdownSoftware_2.SelectedText.Result And
System=ComboBoxSystem_2.Selected.Result
),
Title, // Switch out Title for another column to do the sorting by
Ascending
)
You can sort by different columns, so you need to define which one.
Bryan
Thank you, Bryan. It worked absolutely perfectly. x
I may have closed this too soon!
It seems that if I use Sort on this Combobox, it only works if I have 'Search' disabled on the Combo.
I need the search facility within is item, but if I turn it on then nothing populates the Combobox. If I remove the Sort from the Items and make Search true, then the Combobox gets populated, but isn't in alphabetical order. Any idea why this is behaving in this way?
Could you check these settings available in the properties menu that usually appears on the right-hand side of the editor?:
I wonder if the Primary text and/or SearchField needs to be set correctly on your combobox. I can turn searching on with a Sort() function in the Items and the combobox will both sort correctly and allow searching.
Hi! This image shows how I've set up the Combo Boxes:
Can you spot anything obviously wrong? Also, when I add the sort code to SearchBox_Task_1, I get the Delegation warning triangle.
@Mrsflea99 wrote:
Hi! This image shows how I've set up the Combo Boxes:
Can you spot anything obviously wrong? Also, when I add the sort code to SearchBox_Task_1, I get the Delegation warning triangle.
The only thing really jumping out at me is the Sort() is operating on a column called Task and the combobox is displaying/searching on a column called field_Task. Are those two separate columns in your Keystroke Library table, or is one a mistype?
The yellow triangle is flagging a potential delegation issue if 'Keystroke Library' contains row more than your delegation row limit (default 500, can be set to 2000). We can make that go away through a small change to the code, but for now let's get your combobox working.
Also, try the nearly-identical function SortbyColumns() instead of Sort() -- just remember to put the column name in double quotes for that function. I'm curious if there is any difference.
Hi!
I sorted the issue by declaring a collection and referring to that, rather than the data source directly.
This also fixed my Delegation warning issue! Happy Days.
Thanks everyone for your help. x
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
184 | |
53 | |
50 | |
36 | |
35 |
User | Count |
---|---|
271 | |
91 | |
82 | |
76 | |
75 |