cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

DataTable not updating correctly

Here's the situation:
I use a DataTable inside powerapps to display my local collection of objects. I set the Item property of DataTable like this:

SortByColumns(Search(Table_Object;Input.Text;"Column1";"Column2";"Column3");"Column1")

Now when I add elements to the list everything works fine, the table updates correctly. But when I delete elements from the local collection, it doesn't update well and the deleted elements are still visible even though the collection updated correctly and does not contain those elements anymore. This does not happen when setting the Item property of the DataTable to simply: Table_Object.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: DataTable not updating correctly

@v-xida-msft 
This works fine ! Because the ClearCollect does empty the collection before filling it again. But I tried setting the Data Table property to 'MyDataSource' which is stored in Sharepoint and the problem appears again, and the Timer doesn't help (refreshing the source does not help). This really bugs me, everything about the DataTable is default property except the Items property which is

SortByColumns(Search(MyDataSource;Input_Search.Text;"Column1";"Column2";"Column3");"Column1")

I'm sorry if this seems very weird but the Data Table does update in real time when adding elements, but it does not when deleting elements. 

Edit:
It looks like the problem comes from the use of SortByColumn on the result of Search. When simply setting the Items property to 

Search(MyDataSource;Input_Search.Text;"Column1";"Column2";"Column3")

Everything updates properly, be it add or delete


View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: DataTable not updating correctly

Hi @Anonymous ,

Could you please share a bit more about Table_Object? Is it the local collection that you mentioned?

Where do you pull data into your local collection?

Do you want the Data Table control to be updated/refreshed in real time when you add/delete elements from your collection?

 

Based on the issue that you mentioned, I think the Timer control could achieve your needs. I have made a test on my side, please take a try with the following workaround:

Add a Timer control within your app, set the Duration property to following:

1000

set the AutoStart property and Repeat property to following:

true

set the OnTimerEnd property to following:

Refresh('YourDataSource');;           /* <-- 'YourDataSource' represents the data source in your app, which your Table_Object colelction retrieves records from  */
ClearCollect(Table_Object; 'YourDataSource')

Set the Visible property of the Timer control to following:

false

Note: The Table_Object collection in your app would be refreshed/updated every 1 second.

 

Set the Items property of your Data Table to following:

SortByColumns(
Search(Table_Object; Input.Text; "Column1";"Column2";"Column3");
"Column1"
)

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

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Re: DataTable not updating correctly

@v-xida-msft 
This works fine ! Because the ClearCollect does empty the collection before filling it again. But I tried setting the Data Table property to 'MyDataSource' which is stored in Sharepoint and the problem appears again, and the Timer doesn't help (refreshing the source does not help). This really bugs me, everything about the DataTable is default property except the Items property which is

SortByColumns(Search(MyDataSource;Input_Search.Text;"Column1";"Column2";"Column3");"Column1")

I'm sorry if this seems very weird but the Data Table does update in real time when adding elements, but it does not when deleting elements. 

Edit:
It looks like the problem comes from the use of SortByColumn on the result of Search. When simply setting the Items property to 

Search(MyDataSource;Input_Search.Text;"Column1";"Column2";"Column3")

Everything updates properly, be it add or delete


View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,751)