cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DAVIDPOWELL
Post Prodigy
Post Prodigy

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

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
}
)
)
;

1 ACCEPTED SOLUTION

Accepted Solutions

@DAVIDPOWELL ,

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.

View solution in original post

10 REPLIES 10
WarrenBelz
Super User
Super User

Hi @DAVIDPOWELL ,

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.

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

 

 

Hi @DAVIDPOWELL ,

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.

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.

 

 

DAVIDPOWELL
Post Prodigy
Post Prodigy

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

@DAVIDPOWELL ,

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

Hi @DAVIDPOWELL ,

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
Frequent Visitor

hi @WarrenBelz 

 

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

 

Thx

Helpful resources

Announcements
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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,631)