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?
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?
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
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.
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
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!