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 / Collection Data Column...
Power Apps
Answered

Collection Data Column Sequence not same when Data taken by JSON

(0) ShareShare
ReportReport
Posted on by 2

I am using collection to provide data to JSON. Later this JSON data is used to export to csv as attachment Via Power Automate.

All is working fine, But one issue remains that JSON data column sequence is not same as of collection from where it is been reffered.

Below is the image (green both highlighted) where it can be noted that RecoNo is the first column in the collection code. But in the JSON data it is third column, which indicates that JSON is sorting the header column ascending. But I need to stop this, As sequence of column is important for user.

 

Kindly guide how it can be corrected to avoid JSON column header sorting.

 

MIA27_0-1714541833805.png

 

Full code which is in use :

Clear(colSvcExportData);

ForAll(
 SupportSvcGallery.AllItems As SvcExportData,
 Collect(
 colSvcExportData,
 {
 RecoNo: SvcExportData.RecoNo,
 SvcDate: Text(SvcExportData.SvcDate,"dd-mm-yyyy"),
 Model: SvcExportData.Model,
 SerialNo: SvcExportData.SerialNo,
 SvcSMR: SvcExportData.SvcSMR,
 SvcRemarks: SvcExportData.SvcRemarks,
 SvcExpense: SvcExportData.SvcExpense,
 Customer: SvcExportData.Customer
 }
 )
);

Set(JSONFileSvcExpo,JSON(colSvcExportData)); //this line hold the data in JSON format 

ExpoSvcData.Run(JSONFileSvcExpo,HoldMachDetailsForCsv.Text); //This is power automate flow

Notify("DataExported as CSV file in one drive, and sent email to you",NotificationType.Success,2000);

 

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @MIA27 

    The ColumnName sort in Power App is automatically sorted based on the first letter and cannot be changed.

    But you can custom the columnName sort in Power Automate side by costuming it in the create csv table action like this:

    vyueyunmsft_0-1714542561590.png

    item()?['fieldName']    ---> item()?['RecoNo']

     

    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

     

  • MIA27 Profile Picture
    2 on at

    Thank your advise.

    But in power screen when I select Custom, on right side dailog the field should appear to select the columns as generally we do.

    I cannot see any to select. Below is the image

     

    May we need to type manually for each column.

     

    For Header : item()?['fieldName']    ---> 

    For Value :    item()?['RecoNo']

     

    Confused, please guide

     

     

    MIA27_0-1714543437868.png

     

     

     

     

     

  • Verified answer
    v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @MIA27 

    Thanks for your response!

    Because we use the json() function in the input, so it will not dynamically appear the field to select, we need to use the expression instead.

    In the left , you need to input your columnName  and in the right you need to put the expression like this:

    item()?['fieldName']

     

    vyueyunmsft_0-1714543827096.png

     

     

    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

     

  • MIA27 Profile Picture
    2 on at

    Noted your advise.

    Just one clarification for the right Box (Value) we will type the expression - This one is ok.

    But the Column Header (I mean the left box) - I can type Directly RecoNo Or need also expression as 

    item()?['fieldName']

     

    Please confirm, so that I can proceed further

    Thank you

     

  • Verified answer
    v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @MIA27 

    Thanks for your response!

    Just one clarification for the right Box (Value) we will type the expression - Yes!

    In the left box, you can directly input your ColumnName here instead of the expression.

    vyueyunmsft_0-1714544900129.png

     

     

    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

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

#2
11manish Profile Picture

11manish 193

#3
Valantis Profile Picture

Valantis 138

Last 30 days Overall leaderboard