web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How do i sort text num...
Power Apps
Answered

How do i sort text numerically here?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

Even though i have text there- i would want to sort the values numerically- so that 6.2.10 comes after 6.2.9- please help

Thanks

GauravG_0-1619554383839.png

 

Categories:
I have the same question (0)
  • Sid_Jafri Profile Picture
    478 on at


    Create a column on items and sort it
    Sort(AddColumns('BRD Process Levels', "SortValue",Value(Substitute(Left(LevelColumn,6),".",""))), SortValue, Ascending)

    Use the Level column in your dropdown or Gallery

  • WarrenBelz Profile Picture
    156,456 Most Valuable Professional on at

    Hi @Anonymous ,

    Have you thought of using 6.2.09?

    Otherwise the solution is complex - taking out the . may solve it depending on your structure (629 is before 6210, but is 721 is also before 6210).

     

    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 Power Platform Member Profile Picture
    Microsoft Employee on at

    Didn't even think about that- smart suggestion Warren.

    However, i just checked and since it is process related- i have been told not to introduce 0's.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    You just need to separate out the versions levels...

    Please consider changing your Formula to the following:

    With({_data: 
     Distinct(
     Filter('BRD Process Levels', 
     Level_x0020_2_x0020_Process in DataCardValue11.Selected.Result
     ), 
     Level_x0020_2_x0020_Process
     )
    },
     SortByColumns(
     ForAll(_data,
     With({_itm: Split(Left(Result, Find(" ", Result)-1), ".")},
     {
     Major: Coalesce(Value(First(_itm).Result), 0),
     Minor: If(CountRows(_itm)>1, Coalesce(Value(Last(FirstN(_itm, 2)).Result), 0), 0),
     Version: If(CountRows(_itm)>2, Coalesce(Value(Last(FirstN(_itm, 3)).Result), 0), 0),
     Level_x0020_2_x0020_Process: Result
     }
     )
     ),
     "Major", Ascending,
     "Minor", Ascending,
     "Version", Ascending
     )
    ). Level_x0020_2_x0020_Process

    This will pull the level version number (ending with a space) out and parse it into the Major, Minor and version numbers.  Then it sorts with all three of them.

    Your Dropdown values will now all be sorted by the major, minor and version regardless of inclusion or lack of any level.

     

    I hope this is helpful for you.

  • Verified answer
    WarrenBelz Profile Picture
    156,456 Most Valuable Professional on at

    Hi @Anonymous ,

    I thought I would have a play with some code gymnastics to show you what is required here. The Tag.Text refers to a Text control I was testing with your number sequence. This will get your three numbers, which you can sort by in order

    UpdateContext(
     {
     dot1: 
     Find(
     ".",
     Tag.Text
     )
     }
    );
    UpdateContext(
     {
     dot2: 
     Find(
     ".",
     Right(
     Tag.Text,
     Len(Tag.Text) - dot1
     )
     ) + dot1,
     no1: 
     Value(
     Left(
     Tag.Text,
     dot1 - 1
     )
     )
     }
    );
    UpdateContext(
     {
     no2: 
     Value(
     Mid(
     Tag.Text,
     dot1 + 1,
     Len(Tag.Text) - dot2
     )
     ),
     no3: 
     Value(
     Right(
     Tag.Text,
     Len(Tag.Text) - dot2
     )
     )
     }
    )

     

    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.

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    I must have missed something in your needs.  I though you were trying to sort a dotted list in your dropdown.

     

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Corrected formula:

    With({_data: 
     Distinct(
     Filter('BRD Process Levels', 
     Level_x0020_2_x0020_Process in DataCardValue11.SelectedItems.Result
     ), 
     Level_x0020_3_x0020_Process
     )
    },
     SortByColumns(
     ForAll(_data,
     With({_itm: Split(Left(Result, Find(" ", Result)-1), ".")},
     {
     Major: Coalesce(Value(First(_itm).Result), 0),
     Minor: If(CountRows(_itm)>1, Coalesce(Value(Last(FirstN(_itm, 2)).Result), 0), 0),
     Version: If(CountRows(_itm)>2, Coalesce(Value(Last(FirstN(_itm, 3)).Result), 0), 0),
     Level_x0020_3_x0020_Process: Result
     }
     )
     ),
     "Major", Ascending,
     "Minor", Ascending,
     "Version", Ascending
     )
    ).Level_x0020_3_x0020_Process

     

    And for your Level 4:

    With({_data: 
     Distinct(
     Filter('BRD Process Levels', 
     Level_x0020_3_x0020_Process in DataCardValue12.SelectedItems.Level_x0020_3_x0020_Process
     ), 
     Level_x0020_4_x0020_Process
     )
    },
     SortByColumns(
     ForAll(_data,
     With({_itm: Split(Left(Result, Find(" ", Result)-1), ".")},
     {
     Major: Coalesce(Value(First(_itm).Result), 0),
     Minor: If(CountRows(_itm)>1, Coalesce(Value(Last(FirstN(_itm, 2)).Result), 0), 0),
     Version: If(CountRows(_itm)>2, Coalesce(Value(Last(FirstN(_itm, 3)).Result), 0), 0),
     SubVersion: If(CountRows(_itm)>3, Coalesce(Value(Last(FirstN(_itm, 4)).Result), 0), 0),
     Level_x0020_4_x0020_Process: Result
    
     }
     )
     ),
     "Major", Ascending,
     "Minor", Ascending,
     "Version", Ascending,
     "SubVersion", Ascending
     )
    ).Level_x0020_4_x0020_Process

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard