Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Collection Data Column Sequence not same when Data taken by JSON

(0) ShareShare
ReportReport
Posted on by

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

 

 

 

 

  • Verified answer
    v-yueyun-msft Profile Picture
    on at
    Re: Collection Data Column Sequence not same when Data taken by JSON

    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

     

     

     

  • MIA27 Profile Picture
    on at
    Re: Collection Data Column Sequence not same when Data taken by JSON

    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
    on at
    Re: Collection Data Column Sequence not same when Data taken by JSON

    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
    on at
    Re: Collection Data Column Sequence not same when Data taken by JSON

    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
    on at
    Re: Collection Data Column Sequence not same when Data taken by JSON

    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

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,618 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,957 Most Valuable Professional

Leaderboard