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 / Why my ClearCollect is...
Power Apps
Answered

Why my ClearCollect is empty ?

(0) ShareShare
ReportReport
Posted on by 271

Hi guys,

 

I've put my ClearCollect in App - Onstart, after save the app and play, then close again, check the collection is build but it is empty. Anyone can help me why ?

 

Here is my ClearCollect, which only to have 1 record contains string :

ClearCollect(DetailHeader,
 {
 Order : "Order",
 Date: "Date",
 Category: "Category",
 Description: "Description",
 Qty: "Qty",
 Price: "Price" 
 }
) 

 

Please help.

 

Thanks

Categories:
I have the same question (0)
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Voltes How do you know that there are no records in the collection? Did you do a CountRows(DetailHeader) and check?

  • Verified answer
    GarethPrisk Profile Picture
    2,828 on at

    Putting something like that in the App OnStart will execute the first time the app runs in the studio, and if you "Run Onstart" of the app.

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/object-app#onstart-property

     

    What can be happening is that if you are editing the App OnStart code, then that Collection definition is technically changing each time. When you change how a collection is created, it will no longer exist until you execute the collect again.

     

    The Run Onstart should be fine for you. Your code is legitimate. Just a quirk of the studio.

  • Voltes Profile Picture
    271 on at

    Hi both,

     

    Thanks for replying. Yes, I'm not sure why it is not working when I hit Play, and how I know it is empty is by looking at View - collection. the columns is there but no record.

     

    However, lastly I tried that Apps -> RunOnStart. It is fine after that.

     

    Thanks again both.

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
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard