cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Urgent!!!! No Alphabetical Collections

Hello PowerApps,

 

How Would i Change the setting of my Colluction so it does not order my columns in ascending order from left to right?

 

Thanks,

AskingQuestions

5 REPLIES 5
Super User
Super User

Re: Urgent!!!! No Alphabetical Collections

@AskingQuestions 

Can you explain a little more about what you are seeing or trying to achieve?

You can use the SortByColumns function to sort your collection results in any order you want.  You cannot sort the contents of the collection unless you derive another collection from the first.

Such as :  ClearCollect(colB, SortByColumns(colA, "column"))

 

So, not sure if you are trying to sort the internal contents of the collection, or if you are trying to use your collection in a control such as a gallery or datatable.

In those cases, simply alter your Items property to be something similar to the following:

   SortByColumns(yourCollection, "columnName")

By default these will be ascending sorts. You can add a parameter to the sortby to specify descending if you need that instead.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Re: Urgent!!!! No Alphabetical Collections

@RandyHayes ,

 

My collection header are all by default sorted in Alphabetical Order. I do not want that. I want to change the columns orders to my needs.

 

Thanks,

AskingQuestions

Super User
Super User

Re: Urgent!!!! No Alphabetical Collections

@AskingQuestions 

I'm confused when you say "collection header".  Collections are internal tables and are not displayed.

Are you working with a DataTable control?  If so, then you can reorder the columns as you see fit by draging them around in the field chooser.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted

Re: Urgent!!!! No Alphabetical Collections

@RandyHayes ,

 

The Collection has columns and those columns have names. I do not like that the first column of the collection as a columns that begins with the letter A and then the next  column is begins with the letter b etc. I do not want my collection to be alphabetized.

 

I can I do not see a option to reoder them at all and I have tried switching the order of my code when I initilized my collection but that does not help at all.

 

Thanks,

AskingQuestions

Community Support Team
Community Support Team

Re: Urgent!!!! No Alphabetical Collections

Hi @AskingQuestions ,

Do you want to not sort columns based on alphabetical order?

I'm afraid there's no function about this currently in PowerApps.

For now, PowerApps only have function that cans sort rows.

 

As an alternative way, I suggest you add number before the original fieldname, which will make the columns sort based on the number that you add.

I've made a test, this formula will result collection like this:

ClearCollect(test,{b:"",a:""})828.PNG

//columns sort based on alphabetical order not entering order

While this formula will result collection like this:

ClearCollect(test,{'1b':"",'2a':""})8281.PNG

//columns sort based on number not alphabetical order

 

On your side, you could try this formula:

ClearCollect(collectionname,{'1fieldname1': .... ,'2fieldname2': .... ,'3fieldname3': .... })

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,150)