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.
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);
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.
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
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
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']
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
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
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:
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
WarrenBelz
146,618
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,957
Most Valuable Professional