cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lohaninarayan
Helper I
Helper I

Unable to filter and populate details to a table from collection

Hello all awesome people.

I believe I have a very basic problem but I can not get through it.

I have a form in edit mode and within the form, there is a table to display list of data from a SharePoint list.

Because the list have more than 2000 items and can not be delegated, I an trying to store data to a collection at app start.

The collection is loading the data but when I try to load the collection data to the table, it is coming empty.

Is there anything I am missing or simply PowerApps does not have that ability?

Any help will be appreciated.

Please check attached pics for more understanding.

I have already checked and there is data in the backend to match the condition and Tried to grab all fields or a single field but nothing worked.

lohaninarayan_0-1662531948918.png

lohaninarayan_1-1662532010414.png

lohaninarayan_2-1662532051007.png

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

@lohaninarayan 


I checked your issue more, and you are encountering multiple issues here.

First, the data table must be configured.

There are some steps to so this :

 

1. After adding the Data Table control to the Canvas App, select the Data Table Control, and then on the  very right side panel, under Properties tab, under "Fields", click on the purple text that says "Edit Fields"

2. On the flyout that shows up to the left of that panel, click "Add Field" that has the big plus symbol next to it.

poweractivate_0-1662544649560.png

 

3. In the small flyout that appears, check boxes for all the fields you want
4. and finally click the Add button.

poweractivate_7-1662545815452.png

 

 

You then get the result like this below

but you won't get that result like below with the Collection you have as-is, read on to see why )

poweractivate_3-1662544899099.png

 

However, the Table must not have any sub-tables for this to see those fields

 

Even if you do the above, you'll encounter an issue with your Data Table.

 

You must flatten your table as much as possible first, otherwise, you won't see any fields that are inside nested Tables or nested Collections!

For those items which have sub-tables, even if you check the box for it, like Incident or Role for example, they'll show up as [object Object] and not show anything else. They'll look like this, for example:

poweractivate_4-1662545034925.png

 

The above would be what happens when trying it on coll_02 in my example app - which I think is the closest to where your data is in level of transformation, since coll02 in my example ends up looking something like this:

 

poweractivate_6-1662545342647.png

There are two nested tables in my coll02, Incident and Role, kind of like your Incident and Role, each of which contain more than one record.

I have a custom example where I start with a very multi-dimensional table with nested tables in it, and that table itself is nested - and then I flatten it with multiple steps to turn it into a single table. The first step turns it into coll02 like above, because initially, the whole table is nested in just two readable records, both of which only show this in a Data Table control:

 

poweractivate_5-1662545254307.png

 

 

Here's the full example of how to turn that above, into this instead:

poweractivate_3-1662544899099.png



(I have a sample app later below in this post you can import, but here are the steps in case)

 

First, make a blank app with two blank screens, Screen1, and Screen2. Leave Screen2 blank.

 

Screen1 Onvisible:

 

 

ClearCollect(coll_original,[{id:0,Incident:[{logname:"123name",logid:"123"},{logname:"456name",logid:"456"}],Role:[{rolename:"123name",roleid:"123"},{rolename:"456name",roleid:"456"}]},{id:1,Incident:[{logname:"b123name",logid:"b123"},{logname:"b456name",logid:"b456"}],Role:[{rolename:"b123name",roleid:"b123"},{rolename:"b456name",roleid:"b456"}]}]);

ClearCollect(coll02, ForAll(Distinct(Ungroup(coll_original.Value,"Value"),ThisRecord.Value),Result));

ClearCollect(coll03, Ungroup(coll02,"Incident"));

ClearCollect(coll04, DropColumns(AddColumns(coll03,"logid",ThisRecord.Value.logid,"logname",ThisRecord.Value.logname),"Value"));

ClearCollect(coll05, Ungroup(coll04,"Role"));

ClearCollect(coll06, DropColumns(AddColumns(coll05,"roleid",ThisRecord.Value.roleid,"rolename",ThisRecord.Value.rolename),"Value"));

 

 

Toggle between Screen2 and Screen1 once.

 

Add your Data Table and select coll06 when prompted.

 

To experiment with Data Table fields and what shows on each stage, like for example to change it to coll_original, use the right side, and click Data Source, change it through that dropdown, and when prompted to replace columns, make sure to do so. You better don't change it by the formula bar Items directly.

 

Notice for coll_original, which is the original source collection, it's impossible to see any data at all:

poweractivate_5-1662545254307.png

 

 

Whereas with coll06, you see all the data. With the other collections, you have the ability to see incrementally more or less data depending where in the transformation it is.

 



Working Sample msapp

 

have attached a working (and revised) sample msapp file app31.msapp if you would like to import a full, working example yourself for your convenience.

 

To use the sample msapp attached, follow these steps:

 

1) Download the msapp file attached to this post (it's at the bottom of this post), to Desktop or a folder of your choice, by clicking on it from this post.

2) Create a new, blank Power App Canvas App

3) Go to File -> Open -> Browse

poweractivate_1-1662544680553.png

 

 

4 ) Navigate to location of .msapp file from Step 1, select it, and press the "Open" button.

5 ) The working example msapp file should load

6 ) Toggle between Screen2 and Screen1 once to initialize all the collections.
7 ) You can also check File -> Collections to see the Collections step by step as they are transformed.

8 ) You can try the full working example and also check the working formulas and setup as well in the app.


.

View solution in original post

@lohaninarayan 

 

Hello, I wanted to inform you that I tested it some more, and specifically with your Filter.

 

Your Filter will not work on your collection as is, because Incident is inside a nested table. Incident.Id simply does not even exist! The nested table causes the Incident Id you are looking for to be shadowed in Incident.Value and you may notice yourself the autocomplete won't even attempt to see what's inside Incident.Value .

 

In other words, "Incident.Value.Id" is an impossible thing to attempt to access. This is proper, correct behavior.  The Filter will only work correctly and be able to filter on incident id (which in my sample app, is most closely represented by "logid") after the whole Collection has been fully flattened first, and it probably should be flattened in a similar way as I gave in my initial response, all the way to coll06 in my response (you may also have success only flattening it up to coll04, where I have flattened the Incident, but not the Role).

 

If Incident is structured like in my sample app in your colPeopleInvolved collection, there may be more than one Incident id that corresponds to the outer table. So one row of your colPeopleInvolved actually has two, three, four, or who knows how many Incident Id's. In order for that to be properly checked, the data must be flattened so that the Filter would work as expected.

 

Power Apps doesn't even understand what's beyond Incident.Value in the first place, so it is unable to check what's really in there. The data has to be flattened first. Your attempt to look for Incident.Id won't succeed, because Incident is actually yet another Collection or Table, and it's actually Incident.Value

And Incident.Value is where it stops, so the Filter can't even be done.

 

You should flatten the data first, and then it would work, and I gave a detailed example about how to do it.

 

So in order to make sure your Filter works as intended, you should completely flatten the data first. 

 

Please check my response where I give the detailed instructions on how to configure the data table, how to flatten the data, and include a fully working sample app to try out yourself, and see if it helps @lohaninarayan 

View solution in original post

5 REPLIES 5

@lohaninarayan 

 

I'm not sure because I am checking it very quickly now, but it might be because there are collections nested within your collection such as Incident and Role. You may need to Ungroup (or flatten) them into another Collection with the columns expanded out from all the nested Collections. 

 

If this ends up being what you needed to do, here's some examples of doing this:

 

Aggregation nested collection

Ungroup record from collection 

Also you can check if this pattern works for you below as well (I did not test it):

 

ClearCollect(newColl,Ungroup(Ungroup(colPeopleInvolved,"Incident"),"Role");

//and finally use newColl and see if your data table likes it better

 

See if it helps @lohaninarayan 

@lohaninarayan 


I checked your issue more, and you are encountering multiple issues here.

First, the data table must be configured.

There are some steps to so this :

 

1. After adding the Data Table control to the Canvas App, select the Data Table Control, and then on the  very right side panel, under Properties tab, under "Fields", click on the purple text that says "Edit Fields"

2. On the flyout that shows up to the left of that panel, click "Add Field" that has the big plus symbol next to it.

poweractivate_0-1662544649560.png

 

3. In the small flyout that appears, check boxes for all the fields you want
4. and finally click the Add button.

poweractivate_7-1662545815452.png

 

 

You then get the result like this below

but you won't get that result like below with the Collection you have as-is, read on to see why )

poweractivate_3-1662544899099.png

 

However, the Table must not have any sub-tables for this to see those fields

 

Even if you do the above, you'll encounter an issue with your Data Table.

 

You must flatten your table as much as possible first, otherwise, you won't see any fields that are inside nested Tables or nested Collections!

For those items which have sub-tables, even if you check the box for it, like Incident or Role for example, they'll show up as [object Object] and not show anything else. They'll look like this, for example:

poweractivate_4-1662545034925.png

 

The above would be what happens when trying it on coll_02 in my example app - which I think is the closest to where your data is in level of transformation, since coll02 in my example ends up looking something like this:

 

poweractivate_6-1662545342647.png

There are two nested tables in my coll02, Incident and Role, kind of like your Incident and Role, each of which contain more than one record.

I have a custom example where I start with a very multi-dimensional table with nested tables in it, and that table itself is nested - and then I flatten it with multiple steps to turn it into a single table. The first step turns it into coll02 like above, because initially, the whole table is nested in just two readable records, both of which only show this in a Data Table control:

 

poweractivate_5-1662545254307.png

 

 

Here's the full example of how to turn that above, into this instead:

poweractivate_3-1662544899099.png



(I have a sample app later below in this post you can import, but here are the steps in case)

 

First, make a blank app with two blank screens, Screen1, and Screen2. Leave Screen2 blank.

 

Screen1 Onvisible:

 

 

ClearCollect(coll_original,[{id:0,Incident:[{logname:"123name",logid:"123"},{logname:"456name",logid:"456"}],Role:[{rolename:"123name",roleid:"123"},{rolename:"456name",roleid:"456"}]},{id:1,Incident:[{logname:"b123name",logid:"b123"},{logname:"b456name",logid:"b456"}],Role:[{rolename:"b123name",roleid:"b123"},{rolename:"b456name",roleid:"b456"}]}]);

ClearCollect(coll02, ForAll(Distinct(Ungroup(coll_original.Value,"Value"),ThisRecord.Value),Result));

ClearCollect(coll03, Ungroup(coll02,"Incident"));

ClearCollect(coll04, DropColumns(AddColumns(coll03,"logid",ThisRecord.Value.logid,"logname",ThisRecord.Value.logname),"Value"));

ClearCollect(coll05, Ungroup(coll04,"Role"));

ClearCollect(coll06, DropColumns(AddColumns(coll05,"roleid",ThisRecord.Value.roleid,"rolename",ThisRecord.Value.rolename),"Value"));

 

 

Toggle between Screen2 and Screen1 once.

 

Add your Data Table and select coll06 when prompted.

 

To experiment with Data Table fields and what shows on each stage, like for example to change it to coll_original, use the right side, and click Data Source, change it through that dropdown, and when prompted to replace columns, make sure to do so. You better don't change it by the formula bar Items directly.

 

Notice for coll_original, which is the original source collection, it's impossible to see any data at all:

poweractivate_5-1662545254307.png

 

 

Whereas with coll06, you see all the data. With the other collections, you have the ability to see incrementally more or less data depending where in the transformation it is.

 



Working Sample msapp

 

have attached a working (and revised) sample msapp file app31.msapp if you would like to import a full, working example yourself for your convenience.

 

To use the sample msapp attached, follow these steps:

 

1) Download the msapp file attached to this post (it's at the bottom of this post), to Desktop or a folder of your choice, by clicking on it from this post.

2) Create a new, blank Power App Canvas App

3) Go to File -> Open -> Browse

poweractivate_1-1662544680553.png

 

 

4 ) Navigate to location of .msapp file from Step 1, select it, and press the "Open" button.

5 ) The working example msapp file should load

6 ) Toggle between Screen2 and Screen1 once to initialize all the collections.
7 ) You can also check File -> Collections to see the Collections step by step as they are transformed.

8 ) You can try the full working example and also check the working formulas and setup as well in the app.


.

@lohaninarayan 

Let's suppose you don't care about Incident and Role for colPeopleInvolved, and only want to use those for the Filter itself.

In that case, you can attempt to avoid the flattening in my example altogether, especially if you don't want any of the fields in the nested tables, to be actually inside of the data table. but you should still select the correct non-nested fields to test it, and just try it first without the Filter. Just use colPeopleInvolved for the Items property of the Data Table. Better yet, save your Filter formula somewhere if you need to have it handy, just delete the Data Table Control and just add a new one. When prompted, just select colPeopleInvolved when it shows up.

 

As an initial test, I suggest you try it without the Filter, just have the Data Table on the whole colPeopleInvolved and just try to select the fields in the Steps 1-4 I give in the first part of my response (particularly try to select the fields that don't have a nested table, the fields with a nested table will just show [object Object] if you use colPeopleInvolved as-is) and just see if it even works then and shows something. If it does, then the problem may be with your Filter, and/or because the data has not been flattened, or some other issue. 

 

You can also use completely custom data cards, or just unlock the data cards where you get a roadblock (e.g. Incident) and attempt to get nested data by modifying the datacard itself rather than flatten the data and expose it in a way that results in a built-in datacard. However, this may be rather complex and non-intuitive. Manipulating datacards or using custom datacards might not be an adequate substitute for flattening the data first, so I don't recommend manipulating the data cards, and instead recommend flattening the data where you need direct access to fields inside of a "nested" table.

@lohaninarayan 

 

Hello, I wanted to inform you that I tested it some more, and specifically with your Filter.

 

Your Filter will not work on your collection as is, because Incident is inside a nested table. Incident.Id simply does not even exist! The nested table causes the Incident Id you are looking for to be shadowed in Incident.Value and you may notice yourself the autocomplete won't even attempt to see what's inside Incident.Value .

 

In other words, "Incident.Value.Id" is an impossible thing to attempt to access. This is proper, correct behavior.  The Filter will only work correctly and be able to filter on incident id (which in my sample app, is most closely represented by "logid") after the whole Collection has been fully flattened first, and it probably should be flattened in a similar way as I gave in my initial response, all the way to coll06 in my response (you may also have success only flattening it up to coll04, where I have flattened the Incident, but not the Role).

 

If Incident is structured like in my sample app in your colPeopleInvolved collection, there may be more than one Incident id that corresponds to the outer table. So one row of your colPeopleInvolved actually has two, three, four, or who knows how many Incident Id's. In order for that to be properly checked, the data must be flattened so that the Filter would work as expected.

 

Power Apps doesn't even understand what's beyond Incident.Value in the first place, so it is unable to check what's really in there. The data has to be flattened first. Your attempt to look for Incident.Id won't succeed, because Incident is actually yet another Collection or Table, and it's actually Incident.Value

And Incident.Value is where it stops, so the Filter can't even be done.

 

You should flatten the data first, and then it would work, and I gave a detailed example about how to do it.

 

So in order to make sure your Filter works as intended, you should completely flatten the data first. 

 

Please check my response where I give the detailed instructions on how to configure the data table, how to flatten the data, and include a fully working sample app to try out yourself, and see if it helps @lohaninarayan 

Hi @poweractivate 

 

Thanks for the reply and all examples you have posted.

I have managed to fix the issue with the help of your examples. However, ended up creating different connection;

col1. get the desired list with delegable filter

col2. added new column with incident object value

col3. added new column with role object value

col4. dropped column incident and role object

 And I was able to use col4 to display on my table.

My question to you is, is there a shorter script to have less collections?

I am marking your post as solution because it helped me solve the issue.

 

Thanks

Narayan

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,883)