Hello everyone that is eager and willing to help
I have a current scenario that I want to have the items of my combo box in a custom order
here is my formula in the on select property of my combo box
ClearCollect(
colOfficeLocCustomOrder,
Sort(
Ungroup(
Table(
{Data: Table({Value: "Any - No Preferred Office", Order:1},{Value: "Other Location", Order: 400})},
{
Data:
Distinct(Filter('DATA SOURCE',
SSL = DataCardValueSSL.Selected.Value &&
SMU = DataCardValueSMU.Selected.Value &&
Rank = DataCardValueRank.Selected.Value),
'Office Location')
}
),
"Data"
),
Value
)
);
here is my formula for the items property of my combo box:
SortByColumns(
colOfficeLocCustomOrder,
"Order",
SortOrder.Descending
)
notice here that I added another column to the any preferred office and other location because I want the any preferred no office to be located at the first of the combobox items and the other location be at the last. I was wondering if I can sort them out however those that were filtered did not have any "Order" column.
how can I achieve this?
Thank you for the help! this solved it however not as I wanted do you have any idea how I can sort the filtered data to be alphabetically
arranged?
EDIT:
I solved the other problem with this one
ClearCollect(
colOfficeLocCustomOrder,
AddColumns(
Sort(
Distinct(
Filter(
'DATA SOURCE',
SSL = DataCardValueSSL.Selected.Value &&
Competency = DataCardValueSMU.Selected.Value &&
Rank = DataCardValueRank.Selected.Value
),
'Office Location'
),
ThisItem.OfficeLocation,
SortOrder.Ascending
),
"Order",
2
)
);
hey @kej
you can try something like this:
ClearCollect(
colOfficeLocCustomOrder,
AddColumns(
Distinct(
Filter(
'DATA SOURCE',
SSL = DataCardValueSSL.Selected.Value &&
SMU = DataCardValueSMU.Selected.Value &&
Rank = DataCardValueRank.Selected.Value
),
'Office Location'
),
"Order",
2 // Assigning a default order for filtered items, you might need to adjust the logic to dynamically assign order based on your exact needs
)
);
// Add the fixed items with their specific orders
Collect(
colOfficeLocCustomOrder,
{Value: "Any - No Preferred Office", Order: 1},
{Value: "Other Location", Order: 400}
);
// Now sort the collection for the ComboBox Items property
Sort(
colOfficeLocCustomOrder,
Order,
Ascending
);
Let me know if my answer helped solving your issue.
If it did please accept as solution and give it a thumbs up so we can help others in the community.
Greetings
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional