Skip to main content

Notifications

Community site session details

Community site session details

Session Id : PV2xf/GbelsiBVJeRIjCgc
Power Apps - Building Power Apps
Unanswered

Best way to clear/empty Data Table

Like (0) ShareShare
ReportReport
Posted on 15 Aug 2022 15:29:05 by 29

Hi,

I have a button that gets data from the form and it makes some calculations & produces a set of rows and then patches multiple rows to Dataverse. If the patch is successful, I load the data into a Datatable on the form for the user to view what they just submitted.

I set the filter value for the data table using a variable on the button that does the Patch, this value is one of the textboxes on the form (ItemID)

Now I'm trying to put a clear button on the form to clear this datatable but I'm struggling to do this. I tried setting this filter variable to Blank() when the clear button is pressed, however this breaks the data loading to the datatable... And I'm wondering if I'm doing this in the wrong way.

What is the best way to clear a data table?

 

thanks

 

Categories:
  • alistairhunt Profile Picture
    22 on 02 Feb 2024 at 08:45:02
    Re: Best way to clear/empty Data Table

    If you have a Table variable (varMyTable) and the table has a number of configured columns I have found the following works to clear the data from the table. I only had to set the first columns (Product) to Blank() for it to generate an empty table.

     

    Set(varMyTable, Table( { Product: Blank() } ));

     

  • misco007 Profile Picture
    5 on 17 Aug 2023 at 17:49:54
    Re: Best way to clear/empty Data Table

    I have the same issue, any help?

  • powerbug Profile Picture
    29 on 16 Aug 2022 at 13:47:57
    Re: Best way to clear/empty Data Table

    Let me explain in detail


    I have a form, which takes some data from user. Then it makes a calculation, produces some rows and saves to database. 
    The user wants to see what is  inserted, so I load all these to a data table on the form, called AddedRows
    The Items property on AddedRows has this Filter('TABLE NAME',Field1=filter)
    Filter is a variable I set on the button that adds rows to database
    there's a ClearInput button. that clears the values on the form. I want this to clear the datatable as well. however when I update Filter in this button onclick it makes it mess up next time I load the table



  • AVTS Profile Picture
    538 on 16 Aug 2022 at 13:29:52
    Re: Best way to clear/empty Data Table

    Hi Power to reproduce your issue we need to have the more details of your app as mentioned by RandyHayes.

     

    Thank you . 

  • powerbug Profile Picture
    29 on 16 Aug 2022 at 13:19:46
    Re: Best way to clear/empty Data Table

    Data table is a form control - so how could you empty it on runtime with flow, I'm confused. I'm talking about database tables

  • AVTS Profile Picture
    538 on 16 Aug 2022 at 11:49:18
    Re: Best way to clear/empty Data Table

    How about trying with flows ?

     

     

    AVTS_0-1660650504805.png

     

     

     

  • VJR Profile Picture
    7,635 on 16 Aug 2022 at 11:34:16
    Re: Best way to clear/empty Data Table

    Lets say your current source of data is called TableWithData

    Maybe have another Table called as EmptyTable with the same columns as TableWithData which will always be blank with only headers.

    Use IF formula on the Datatable Items property, such that when you want to show empty records show EmptyTable, else TableWithData.

     

     

    Edit: just to clarify, TableWithData and EmptyTable are Excel tables as an example. In your case could be something else.

  • powerbug Profile Picture
    29 on 16 Aug 2022 at 10:53:40
    Re: Best way to clear/empty Data Table

    I'm afraid I can't share screenshots as it's confidential (even the names of controls)
    All I want to do is empty a datatable on the form by pressing a button and struggling to do this 

  • powerbug Profile Picture
    29 on 16 Aug 2022 at 10:52:25
    Re: Best way to clear/empty Data Table

    this doesn't work for the data table.

    Invalid argument type (Control)  Expecting a Table value instead

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 15 Aug 2022 at 15:44:48
    Re: Best way to clear/empty Data Table

    @powerbug 

    Can you provide more details on your app (screenshots) including the controls in the screen as well as any formulas you currently are using that are not working?

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started