cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sel_wee01
Frequent Visitor

Sort combination of Text and Number

Hi Community,

I've this problem here. I'm trying to sort the item in my gallery based on the item's column Title in Share Point. The thing is my title is a combination of text and number such as LCP1, LCP2, LCP3, and so on. Let me illustrate as per picture below: 

sel_wee01_0-1614666485318.png

For the purpose of this question, I've included the items' ID label which is referred from SharePoint list to make it clearer. From the image above, the item ID is not in order, but using the sort and filter function I've managed to sort the item based on Title (LCP1,LCP2,LCP3.etc.). 

 

The code used to sort the gallery is:  

 

SortByColumns(
Filter(
childItem,
MainCode.Id = Gallery2.Selected.ID && TextInput1_1.Text in Title
),
"Title",
Ascending
)

 

The issue is the code only works if the item does not exceed more than 10 (LCP10).  Once the item goes more than that (LCP11 - LCP19) , the system recognizes this value less than LCP2. See picture below for example if item exceeded 10.

 

sel_wee01_1-1614667458282.pngIs there any workaround for this problem?  Truly need help for this problem as the items' title order is key feature in this app. Thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @sel_wee01 ,

 

According to your description, I've made a test for your reference:

1\ Add a button control and set its onselect property to:

ClearCollect(AAA,{Title:"TMF1"},{Title:"TMF10"},{Title:"TMF11"},{Title:"TMF2"},{Title:"LCP2"},{Title:"LCP3"},{Title:"LCP4"},{Title:"LCP5"},{Title:"LCP12"})

 

2\ Add a gallery control and set its Items property to:

SortByColumns( AddColumns(AddColumns(AAA,"Test",Value( Mid(ThisRecord.Title,4))),"Test2",Left(ThisRecord.Title,3)),"Test2",Ascending,"Test",Ascending)

 

3\ The result is as follows:

v-xiaochen-msft_0-1615529444857.png

 

So, you could try this formula:

SortByColumns( AddColumns(AddColumns(Filter(

childItem,

MainCode.Id = Gallery2.Selected.ID && TextInput1_1.Text in Title

),"Test",Value( Mid(ThisRecord.Title,4))),"Test2",Left(ThisRecord.Title,3)),"Test2",Ascending,"Test",Ascending)

// The string length of "TMF" and "LCP" are both 3. 

If you have strings of other lengths, you need to use the If() function to judge.

 

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

View solution in original post

2 REPLIES 2
ArminSimon
Helper I
Helper I

Hi,

this works as designed for text sorting, if you like to sort as you expected, I would split the text in two fields and extend the sort for those two field, or just use the two fields you already used to combine the title.

 

Please click Accept as Solution so that others may find it more quickly if this post solve your problem.
If you liked my response, please give it a Thumbs Up.

v-xiaochen-msft
Community Support
Community Support

Hi @sel_wee01 ,

 

According to your description, I've made a test for your reference:

1\ Add a button control and set its onselect property to:

ClearCollect(AAA,{Title:"TMF1"},{Title:"TMF10"},{Title:"TMF11"},{Title:"TMF2"},{Title:"LCP2"},{Title:"LCP3"},{Title:"LCP4"},{Title:"LCP5"},{Title:"LCP12"})

 

2\ Add a gallery control and set its Items property to:

SortByColumns( AddColumns(AddColumns(AAA,"Test",Value( Mid(ThisRecord.Title,4))),"Test2",Left(ThisRecord.Title,3)),"Test2",Ascending,"Test",Ascending)

 

3\ The result is as follows:

v-xiaochen-msft_0-1615529444857.png

 

So, you could try this formula:

SortByColumns( AddColumns(AddColumns(Filter(

childItem,

MainCode.Id = Gallery2.Selected.ID && TextInput1_1.Text in Title

),"Test",Value( Mid(ThisRecord.Title,4))),"Test2",Left(ThisRecord.Title,3)),"Test2",Ascending,"Test",Ascending)

// The string length of "TMF" and "LCP" are both 3. 

If you have strings of other lengths, you need to use the If() function to judge.

 

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (69,234)