Showing results for 
Search instead for 
Did you mean: 
Not applicable

Collection in DataTable



I have a datatable with a collection as datasource. I also have a button that fires the Collect function so that i fill the collection with data. But why does not the datatable update? Does it only take a copy of the collection at start up and present that data? Now I have to restart the whole app for the datatable to show the new data...


Is there maybe a functon that can force the datatable to read from the collection again..?

Super User
Super User

Re: Collection in DataTable

Hello krigj,

Button1.OnSelect : Collect(Collection1,{ID:1,text:"A"})
DataTable1.Items : Collection1
I set the DataTable to display the ID and text.

Whenever I press the button I can see the added data on the DataTable.
What is different in your case? Is your collection nested?

Not applicable

Re: Collection in DataTable


I will show you my code on how I add data to my collecton. The Collection is not nested, and all data is added to the collection in the way i want.


//I am using this index collection so that i can use the ForAll as a normal for-loop ish with increasing index variable
ForAll([1,2,3,4,5,6,7,8,9,10],If(Value <= CountRows(Split(ThisItem.Signhist,",")),Collect(IndexForDetails,Value)));

//Make the DetailTable as a Collection
     Event_Log: Last(FirstN(Split(ThisItem.Signhist,","),Value)).Result,

     Status: If(CountRows(Split(ThisItem.Statushist,","))>=Value,

     Date: If(CountRows(Split(Substitute(ThisItem.Datehist,"&#58;",":"),","))>=Value,
     Last(FirstN(ForAll(Split(Substitute(ThisItem.Datehist,"&#58;",":"),","),Text(Result,"[$-en-US] hh:mm")),Value)).Value,

     Comment: If(CountRows(Split(Substitute(ThisItem.Comment_Mod_Hist,"&#58;",":"),"#"))>=Value,

//The Datatable is placed on the GeneralDetailScreen Navigate(GeneralDetailScreen,ScreenTransition.Fade)

So as you can see I have different Strings of the same length with delimiter "," or "#" so the data saved in the String can be easy accesed. The Strings can contain different amount of values, therefore the if in the three last fields. 


But as I am saying, all the values is written to the collection, but does not show in the datatable.


In "Items"-field of the datatable i write "DetailTable" which is the name of the collection, and I can see that it takes the refrence to the collection.. I have also set the datatable to show all of the four fields; Event_Log, Status, Date and Comment

Super User
Super User

Re: Collection in DataTable


Unfortunately I can't recreate what you are trying to do in order to test it. I don't have the ThisItem.etc values
If you try to use a gallery instead of a datatable? Do you have the same issue?

Not applicable

Re: Collection in DataTable

Tried it now, works perfect with a gallery! The ThisItem is a row in a SharePoint list btw. 


I will probably just use the gallery now then.. Thanks @Mike8

Community Support
Community Support

Re: Collection in DataTable

Hi @Anonymous,


I didn't create the collection in your way, but just a simple one:



When I put "C" in the data table, and change the data in TextInput control, data table would change according to what I fill in TextInput control:




Notice that, I need to first click on the button, and make the Name column created already, then add it to the data table:



Are you using DetailTable in the data table control? If so, please check if you have included the columns in DetailTable collection in data table. Also, check if these columns are still there after changing according to your formula.


I saw in your formula that create the DetailTable, there are "ThisItem.". Where did you put this formula? What did you get the value of "ThisItem."?




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

Re: Collection in DataTable

I ended up using a gallery instead...but I did all the things that you are showing here @v-monli-msft 


The columns where yet selected after I used the formula and the ThisItem is from a Gallary that holds data from a sharepoint list. As I have said all the data were saved to the Collection, but it would not update in my datatable. I needed to restart my app to see the changes everytime.

Helpful resources

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...


New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,169)