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 / Creating a blank recor...
Power Apps
Unanswered

Creating a blank record of a SharePoint list item while preserving the column structure

(0) ShareShare
ReportReport
Posted on by 400

I'm working on an app where I'd like to get a blank record whose columns are based on a SharePoint list.

 

I've tried:

  ClearCollect(myCollection, First(Filter(myList, ID=-1)))

and...

  ClearCollect(myCollection, myList);

  Clear(myCollection)

 

Both of these techniques return the columns, but there technically isn't a record... it's an empty list. I want -ONE- single record that contains the columns and whose records are all nulled/blank.

 

The only other technique I can think of is:

  ClearCollect(myCollection, Filter(myList, ID=[existing ID]));

  Patch(myCollection, First(myCollection),
    {
      Column1: Blank(),
      Column2: Blank()

      ...
    }

  )

 

This seems really involved, especially since my list has over 2-3 dozen columns. Is there an easier way to do this?

 

I want to mention that my emphasis for this question is on method, not syntax (in case I messed up my syntax for whatever reason).

Categories:
I have the same question (0)
  • Dianey Profile Picture
    86 on at
    Do I understand correctly that you just want to add a new, empty row to your collection? I've done this using Collect:

    Collect(myCollection,. {ID: Blank()})

    I actually set the ID to a value, but I'm presuming Blank() will work here too)
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @tommyly ,

    Do you want to get the Blank record from a SP List?

     

    Based on the formula you provided, I think there is something wrong with it. Actually, you should not save the filtered result into a collection within your app.

    Currently, within PowerApps, the collection would be acted as a Table value rather than record value. Even though, you save a Blank record into the collection, the collection would be acted as empty table rather than Blank record.

     

    As an alternative solution, I think global variable could achieve your needs. You could consider save the filtered result into a variable. Please consider take a try with the following formula:

    Set(BlankRecord, LookUp(myList, ID = -1))

    Then you could reference the column value through the following formula:

    BlankRecord.Column1
    BlankRecord.Column2

    ...

    You could review the Blank record data structure using Data Table as below:

    5.JPG

     

    Actually, the result the LookUp(myList, ID = -1) formula returned is just a Blank record. It is not necessary to save the the result into a collection, you could use it directly within your app.

     

    If you just want to save the Blank record into a collection, and want the Blank record to be be acted as below:

    6.JPG

    I think the Defaults() function could achieve your needs. Please consider modify your formula as below:

    ClearCollect(myCollection, Defaults(myList))

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • tly Profile Picture
    400 on at

    When I purposely filter for a non-existent ID (whether Blank() or -1), it returns an empty table--which is not my goal. My intention here is to create a real, tangible record (in contrast to a table with multiple records or a table with no records) with blank values within each field. The result would be a blank, editable record of sorts--which I'll arbitrarily call a "Blank Record" (not an empty table).

     

    The ultimate goal is this: Fields on the app have their default setting dynamically set to:

      If(IsBlank(blankRecord.fieldA), copyOfDataSourceRecord.fieldA, blankRecord.fieldA)

     

    When the user refreshes the data, this occurs:

      If(Connection.Connected,

        Refresh(DataSource);

        ClearCollect(copyOfDataSourceRecord, First(Filter(DataSource, ID=X)))
      )

     

    That way, while offline, user input is recorded in the blankRecord collection. If the user refreshes the data, it will only refresh the fields that the user has not updated yet (because they'd be blank). The fields where the user has updated, the user's changes supersede what has updated on the data source.

     

    I thought more about this and I know that you can create a sort-of-blank record using Defaults(dataSource), but I don't think this works the same way with collections--e.g. Defaults(collection)--as collections don't seem to inherit default values and meta-information of that sort.

  • Dianey Profile Picture
    86 on at

    Did you try the suggestion above of: 
    ClearCollect(myCollection, Defaults(myList))

     

    If myList is your actual data source, then presumably you'd get the defaults from there added as a new row to your collection. 

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 432

#2
Valantis Profile Picture

Valantis 362

#3
timl Profile Picture

timl 337 Super User 2026 Season 1

Last 30 days Overall leaderboard