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 / Change the Column orde...
Power Apps
Answered

Change the Column order in a Collection from data in a Gallery

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

This code creates a Collection from a Gallery.

However, the Collection keeps putting the Columns in Alphabetical order ?

I need the Collection in this order ?

 

Thanks

David

 

Clear(colGallerytest)
;
ForAll(gallery_export_detail_records.AllItems,Collect(
colGallerytest,
{RBP_MASTER_ID:lbl_ID_25.Text,
SKU:lbl_Sku_25.Text,
RENEWAL_SKU: lbl_Renewal_Sku_24.Text,
RENEWAL_OLVP_QUOTENUMBER: Label80_22.Text,
PRODUCT_DESCRIPTION: lbl_Description_25.Text,
QTY: lbl_Qty_25.Text,
TARGET_PRICE: lbl_Target_Price_24.Text,
TARGET_GP: lbl_Target_GP_20.Text,
CURRENT_PRICE: lbl_Current_Price_24.Text,
CURRENT_GP: lbl_Current_GP_2.Text,
VENDOR_GUIDELINE_GP: lbl_VendorGuideline_GP_2.Text,
APPROVED_PRICE: lbl_Approved_Price_2.Text,
APPROVED_GP: lbl_Approved_gp_2.Text,
SEND_TO_LEADER: lbl_send_to_leader_25.Text
}
)
)
;

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    Hi @Anonymous ,

    You did not say what order, but you would do this

    ForAll(
     Sort( 
     gallery_export_detail_records.AllItems,
     YourSortField
     ),
     Collect(
     colGallerytest,
     ...
     )
    )

     

    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

    Warren,

    Not wanting to sort.. Wanting the fields in the collection the same order i have them here.

    Column1 = RBP_MASTER_ID:lbl_ID_25.Text,
    Column2 = SKU:lbl_Sku_25.Text,
    Column3 = RENEWAL_SKU: lbl_Renewal_Sku_24.Text,
    etc...

     

    The Collection code puts these Columns in alphabetical order....?



    Column1 = APPROVED_GP: lbl_Approved_gp_2.Text,

    Column2 = APPROVED_PRICE: lbl_Approved_Price_2.Text,

    Column3 = CURRENT_GP: lbl_Current_GP_2.Text,

    Column4 = CURRENT_PRICE: lbl_Current_Price_24.Text,

    Thanks

    Dave

     

     

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

    Hi @Anonymous ,

    I never actually thought of that before, but all collections are in alphabetical order when viewed in View > Collections. There are no settings that would change this - why do you want to do this?

     

    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

    because i'm trying to run a Flow to export the data out of the Collection to a csv file or excel...

     

    and i want the export in a specific order.

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    ok, i figured it out in flow.

    this was the expression for bringing in a field..

    item()?['rbp_master_id']

     

    fix set column order by csv .jpg

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

    @Anonymous ,

    It would have been good to include that in your original post. You can do the same thing with Concat() in Power Apps, with the fields in order separated by a comma and Char(10) at the end, then send that as the csv content.

     

    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.

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

    Hi @Anonymous ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    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.

  • GuillaumeP Profile Picture
    29 on at

    hi @WarrenBelz 

     

    Could you explain the concat() function to order collection columns ? don't found the good syntax.

     

    Thx

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

    @GuillaumeP 

    Document is here

  • ShiroKame Profile Picture
    19 on at

    Thank you so much!!!!!

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 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard