cancel
Showing results for
Did you mean:
Post Prodigy

## Sort by numbers and letters

Is there a way I can sort my combobox by ascending numbers and letters. For example I have 1a showing up in the middle and 10 at the top. I want it to go 1a,1b,2...etc. Some numbers dont have a part a,b.

This is in my onvisible for the screen - ;ClearCollect(
scen,
{Result: "All items"}
);
Collect(
scen,
Sort(
Distinct(
UATData,
Scenario
),
Result
)
) Then the items for the combobox is scen.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support

I assume there is a table:

``````ClearCollect(
UATData,
{Scenario:"2b"},
{Scenario:"1a"},
{Scenario:"2a"},
{Scenario:"10ac"},
{Scenario:"10ab"}
)``````

You could try:

``````Sort(
Sort(
Distinct(UATData,Scenario),
Match(Result,"[a-zA-Z]+").FullMatch
),
Value(Match(Result,"\d+").FullMatch)
)``````

The Result:

Best Regards,

Bof

4 REPLIES 4
Super User

I would simply change the 1a to 01a - it would get very complex if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Community Support

I assume there is a table:

``````ClearCollect(
UATData,
{Scenario:"2b"},
{Scenario:"1a"},
{Scenario:"2a"},
{Scenario:"10ac"},
{Scenario:"10ab"}
)``````

You could try:

``````Sort(
Sort(
Distinct(UATData,Scenario),
Match(Result,"[a-zA-Z]+").FullMatch
),
Value(Match(Result,"\d+").FullMatch)
)``````

The Result:

Best Regards,

Bof

Super User

Go with @v-bofeng-msft on this - a good solution

Post Prodigy

This works thank you. I already made another post about this but the other trouble I am having is filtering within the combobox based on another column. For example this is my items in the gallery Filter(
collUATMasterData,
C5 = "Sales",
If(
IsBlank(ComboBox1_2.Selected.Result) || ComboBox1_2.Selected.Result = "All items",
true,
C5 in ComboBox1_2.SelectedItems
) && If(
IsBlank(ComboBox1_3.Selected.Result) || ComboBox1_3.Selected.Result = "All items",
true,
C4 in ComboBox1_3.SelectedItems
)&& If(
IsBlank(Filter_1.Text),
true,
Filter_1.Text in C2
) && If(
IsBlank(Filter.Text),
true,
Filter.Text in C6
)). So my dropdown is bringing in items for other values of C5 = x but I only want the scenario combobox to show scenarios where C5 = Sales. Can I alter what you gave me to do this ? @v-bofeng-msft