web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / renameColumns will cau...
Power Apps
Unanswered

renameColumns will cause collection column sequence change!!!

(0) ShareShare
ReportReport
Posted on by 76

I'm in china, assume you have a collect with column a_xx, b_yy, c_zz(xx/yy/zz is a chinese char), if you want to remove the prefix of a_, b_, c_, you use a renameColumns function:

Collect(_newOne, RenameColumns(

  "a_xx","xx",

  "b_yy", "yy",

  "c_zz", "zz")

)

 

the _newOne collection columns sort is not as expected sequence as: xx-yy-zz.

 

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,479 Super User 2025 Season 2 on at

    Sorry is there a question? 

    also what order is your collection? 

  • Michael E. Gernaey Profile Picture
    53,479 Super User 2025 Season 2 on at

    Sorry is there a question? 

    also what order is your collection? 

  • v-yueyun-msft Profile Picture
    on at

    Hi , @fgu3029 

    According to your description, you use the renamecolumns() function to update the column name.

    I test it in my side :

     

    Set(datatest, [{a_名字:"zyy",b_班级:"Class1",c_成绩:20},{a_名字:"zyy2",b_班级:"Class2",c_成绩:30},{a_名字:"zyy3",b_班级:"Class3",c_成绩:40} ]);
    Set(dataetst2 , RenameColumns(datatest ,"a_名字","名字","b_班级" , "班级","c_成绩" ,"成绩"));

     

    vyueyunmsft_0-1707283350066.png

    And this should just be some kind of initials to show the data of the column.This is by design in Power App.

    vyueyunmsft_0-1707283598795.png

     

    Do you mean the [成绩] column convert  to before the [班级] column?

    If that's the case, that's okay, because all the controls can set their own display position, as long as they have the corresponding data.

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

  • fgu3029 Profile Picture
    76 on at

    thank u very much!

     

    Yes, maybe with apps, It's OK (you can set display column & display order in dataset or gallery), but I will export collection to a excel file, so the collect order is very import for me.

  • v-yueyun-msft Profile Picture
    on at

    Hi , @fgu3029 

    Thanks for your quick response!

    Which method your export to the Excel file , do you use the flow to export ? If you use the flow , you can use the "Select" action to reorder your array field .

     

    Best Regards,

    Yueyun Zhang

  • fgu3029 Profile Picture
    76 on at

    yes, use a flow to export, 

    1, In apps, parse collect to json

    2, use a flow to export to excel (Premisely put the apps parseJson result into flow parseJson function)

    → so then collection column sequence is the final excel sequence.

    col1:学号(No)

    col2:姓名(Name)

    col3:学科(Subject)

    col4:成绩(Score)

    So the collect column sequence is very import for me!

  • v-yueyun-msft Profile Picture
    on at

    Hi , @fgu3029 

    You can use the "Select" action in your flow to custom the column sequence in your flow, like this:

    vyueyunmsft_0-1707289037511.png

    In Power App , you just need to pass a table.

    Set(datatest, [{a_名字:"zyy",b_班级:"Class1",c_成绩:20},{a_名字:"zyy2",b_班级:"Class2",c_成绩:30},{a_名字:"zyy3",b_班级:"Class3",c_成绩:40}    ]);
    Set(dataetst2 , RenameColumns(datatest ,"a_名字","名字","b_班级" , "班级","c_成绩" ,"成绩"));
    renameColumnswillcause.Run( JSON(dataetst2) );
     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard