cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ShaneITAutomate
Post Patron
Post Patron

Sorting or addcolumn by a Text and Numbers column in a collection

Hi,

 

I have a collection (colTEST) i made from a sharepoint List (TESTLIST) in where the naming convention of a column (TESTID) is is AB1 to AB900

 

I believe (is there a better way) that the best way would be to remove the AB or add a column so i can sort by it. however the code im using just doesnt work,

 

could someone help as this code doesnt work

 

ClearCollect(colTEST, AddColumns(TESTLIST,
"SORTID",
Mid(colTEST.TESTID, 3, 10)
)

 

any suggestions would be appreciated

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ShaneITAutomate 
Consider this:

ClearCollect(colTest,Sort(AddColumns(Table1, "sortid",Substitute(TESTID,"AB","")*1),sortid,Descending))

 

Or
ClearCollect(colTest,Sort(AddColumns(Table1, "sortid",Substitute(TESTID,"AB","")*1),sortid))
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

2 REPLIES 2
Drrickryp
Super User
Super User

Hi @ShaneITAutomate 

ClearCollect(
              colTest, Sort(
                             AddColumns(TESTLIST, "sortid", 1*Mid(
                                                                   TESTID,3
                                                               ),
                             ), sortid
                         )
)

Hi @ShaneITAutomate 
Consider this:

ClearCollect(colTest,Sort(AddColumns(Table1, "sortid",Substitute(TESTID,"AB","")*1),sortid,Descending))

 

Or
ClearCollect(colTest,Sort(AddColumns(Table1, "sortid",Substitute(TESTID,"AB","")*1),sortid))
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (5,284)