Upvote 1

Filter nested Data Grid by the value of one of its parent fields

In Progress Green Zhukovsky 6 years ago

Hi,

I'm trying to filter a nested Data Grid by the value of one of its parents fields.

For example, I want to show a list of users, while each user element has a list of its friends.

As an input, I have a Data Master called Users, where (among other fields) I have a user ID and a Friends field, which contains comma-delimited list of this user's friends.

In order to accomplish that, I've created a Data Grid for this Data Master, and put another, nested Data Grid for the same Master inside the Grid Cell. Afterwards, I've tried to achieve the filtering of the nested Data grin on page load in the following ways:

1. FILTER(UsersDataMaster, (NestedFriendsField HAS ParentUserId)) - returns an empty data grid

2. FILTER (UsersDataMaster, (ParentFriendsFieldHAS NestedUserId)) - returns an empty data grid (the friends fields are built in the way that if one user have another one in friends, the another one has the first one in friends as well)

3. FILTER(UsersDataMaster, SELECT(UsersDataMaster, FriendsField) HAS ParentUserId) - returns all of the Data Master recordsWhat do I miss?

Replies (2)
photo
1

It's hard to say exactly why it might not be working. Can you attach the file here in .zip format so we can take a look?

photo
1

of course. It's just one example (btw, it works just mega-slow, so I've limited the parent Data Grid to show only one record), but I've tried three of above - and did not succeed.

photo
1

Can you clarify the desired goal? Why are you using a nested Data Grid?

photo
1

At the end it should be a reusable component which gets User ID from a variable and displays given User info (in the parent Data Grid) and his Friends (in the nested one). In the example I've attached the User ID is hardcoded.

photo
1

Attached is an updated example. We found a limitation with nested data grids, where Set Value actions won't correctly apply, so the filter won't work. As a workaround until we fix this, moving the data grid so it's not nested allows it to be filtered.

photo
1

In this example you've just made two Data Grids filtered by the same User ID. In other words, displaying (for example) a list of users, where each user will have his friends displayed, is not possible at the moment, am I right?

photo
1

The first data grid (users_and_friends) is filtered by the value in the input field at the bottom of the screen. Then, the second data grid (friends) is filtered by what's listed in the filtered users_and_friends data grid. Does that make sense?

photo
1

I get that. Now imagine, for the same example, that I want to display 10 users (filtered by some criteria) in the parent Data Grid (instead of one user in the current example). This way I can't have a single ID to rely on for filtering both of the Data Grids; there are multiple IDs now, and they're dynamic. Is there any reliable workaround for such case?

photo
Leave a Comment
 
Attach a file