web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create empty collection
Power Apps
Unanswered

Create empty collection

(0) ShareShare
ReportReport
Posted on by 294

Is it possible to create an empty collection?

Categories:
I have the same question (0)
  • hnguy71 Profile Picture
    347 on at

    You can create a collection with no data if that's what you need. For example:

    ClearCollect(SampleCollection,
    {
     Field1: Blank(),
     Field2: Blank()
    });
  • Verified answer
    RezaDorrani Profile Picture
    12,143 on at

    Hi @ck25415 

     

    ClearCollect(colEmpty,Blank())

     

    This will create a empty collection with a column called "Value"

     

    Regards,

    Reza Dorrani

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • seadude Profile Picture
    1,855 on at

    Hi @ck25415 ,
    For an absolutely blank Collection, you can do ClearCollect(colTestBlank, {}). The results of this one are:

    image.png

  • v-yutliu-msft Profile Picture
    on at

    Hi @ck25415 ,

    Could you describe more clearly about the empty collection's structure?

    Does the collection have fields?

    Which do you extrally want

    1)have fields with empty value?

    2)have no field?

    3)something else?

     

    Best regards,

  • ck25415 Profile Picture
    294 on at

    @RezaDorrani Thanks, that worked. I tried ClearCollect(emptyCol,"") and other suggestions from this post but the count  showed 1 even though there are no items in the collection.

  • NatEvansIT Profile Picture
    62 on at

    I wasn't sure what the official resolved resolution for this question was but I managed to work out how to create the default table layout I wanted and then to make sure it was empty. Posting here in case it helps others 🙂

     

    //Create a Collection (table) that has column headers of SwitchID, SwitchModel, SwitchValue, SwitchPort, ConnectedDevicePort

    ClearCollect(COL_SwitchHierachy,

    {SwitchID: "",
    SwitchModel: "",
    SwitchValue: "",
    SwitchPort: "",
    ConnectedDevicePort: ""});

    //The above creates a blank row, I want an empty table so I next clear the collection but keep the column headers

    Clear(COL_SwitchHierachy)

     

     

  • ell10706 Profile Picture
    112 on at

    For anyone who's tried to use the above method but is dealing with integer values, I found that "Value("")" will create a blank number value in the table.  

  • JordanDeVan Profile Picture
    73 on at

    If you want an empty collection with the fields from a datasource. ClearCollect(col_empty,FirstN(data_source,0))

  • RJM07 Profile Picture
    801 on at

    This also works real well if you just want a totally blank collection

     

    ClearCollect(collEmpty,{Field1:Value(""),Field2:Value("")});
    Clear(collEmpty)

     

    You can swap out 'Value("")' for Blank() if it's for text opposed to numbers

     

    The 'ClearCollect' makes a blank collection and the immediate 'Clear' removes the annoying blank row

     

  • caballo111 Profile Picture
    3 on at

    Thanks! How did you come with this solution?
    I tried with Blank(), but then couldn't do an updateif with a number (column was expecting objNull and received a Number).
    I tried with Value(Blank()), but that evaluated to 0.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard