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 / ClearCollect SQL View ...
Power Apps
Answered

ClearCollect SQL View Col Ordering

(0) ShareShare
ReportReport
Posted on by 65

I have a simple ClearCollect(Collection, SQLview);

 

It seems like when PowerApps reads a SQLview it puts the columns in alphabetical order instead of the order created in the view.

 

How can I create my Collection with the col order I need.

I am using the Collection to create an Excel file and I need the columns to be in a certain order.

 

As a default I would like the Cols to be in the order of the view or if possible I would like to select specific cols from the view for my export.

 

Thanks

 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,016 Most Valuable Professional on at

    Try surrounding the sqlview data source with a showColumns() function.  That should let you pick the columns you want to include and specify the order in which they appear.

  • rashantha Profile Picture
    65 on at

    That worked partially by selecting specific cols, but when it went to export the file to CSV it did in alphabetical order.

     

    My flow gets the content from PowerApps and runs create CSV 

    rashantha_0-1667870256059.png

     

  • Pstork1 Profile Picture
    69,016 Most Valuable Professional on at

    What is the JSON() function you are using in the Create CSV table.  Why not just pass it the output of the ContentPO Compose?

  • rashantha Profile Picture
    65 on at

    @Pstork1 

    thanks for your assistance.

     

    Here's my ClearCollect statement

    ClearCollect(openPOs, ShowColumns(RDS_OpenPOWarehouse,"PO_No","Item_No","Description","Rec_Date","Rec_Qty", "Qty","Exp_Date","Box_Num","Vendor_Code","Vendor"));

    When I look at the collection it's alphabetical. So it seems like an issue in PowerApps.

    rashantha_0-1667929181411.png

    Here's my JSON

    {
     "inputs": "@triggerBody()['ContentPO_Inputs']",
     "metadata": {
     "operationMetadataId": "4ae39b0c-f310-4eq1-b46e-9bedd7199775"
     }
    }

     

    Create CSV table

    json(outputs('ContentPO'))
    col is set to automatic

     

  • Verified answer
    rashantha Profile Picture
    65 on at

    The answer came from Reza Dorrani, thanks.

     

    Use expressions in the Columns by selecting Custom.

    then use the expression item().['col_name'] in the Value field and your choice in the Header field.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 94

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard