cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
DonutsSauvage
Level: Powered On

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
DonutsSauvage
Level: Powered On

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


2 REPLIES 2
Community Support Team
Community Support Team

Re: DataTable not updating correctly

Hi @DonutsSauvage ,

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.
DonutsSauvage
Level: Powered On

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


Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Tomorrow, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 297 members 5,062 guests
Please welcome our newest community members: