cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

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
Highlighted
Super User
Super User

Re: Urgent!!!! No Alphabetical Collections

@Anonymous 

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.
Highlighted
Anonymous
Not applicable

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

Highlighted
Super User
Super User

Re: Urgent!!!! No Alphabetical Collections

@Anonymous 

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
Anonymous
Not applicable

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

Highlighted
Community Support
Community Support

Re: Urgent!!!! No Alphabetical Collections

Hi @Anonymous ,

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,052)