cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
powerapps890
Post Prodigy
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
v-bofeng-msft
Community Support
Community Support

Hi @powerapps890 :

I'v made a test for your reference:

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:

vbofengmsft_0-1633662290356.png

Best Regards,

Bof

 

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @powerapps890 ,

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.

 

v-bofeng-msft
Community Support
Community Support

Hi @powerapps890 :

I'v made a test for your reference:

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:

vbofengmsft_0-1633662290356.png

Best Regards,

Bof

 

View solution in original post

@powerapps890 ,

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

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 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,235)