Filtering tables in my first shopping app

I had an idea for an app for checking what an user has bought.
I have 3 SQL tables: users, documents and products. Every product has assigned a document and every document contains at least one product. Also every document has assigned an user and every user can have multiple documents.
So I'm querying users and putting them in table. Then if a row of that table is selected, another query is getting all documents of selected user. Those are getting listed on List View of Collapsible Containers. So every Collapsible Container represents a document.
The problem I have is I was trying putting a table with products inside those containers, but I can't figure out how to filter those product tables. I was thinking, maybe query all products of selected user and filter the results through query transformer and somehow passing a document Id from List View to that transformer? I can't figure this part out.
Any ideas?

Got it!

So now I have table with clients and I can filter it using Text Input.
When row with client is selected, I run query to get selected client documents and another one for products.
Then List View gets populated with Collapsible Containers of documents and I set List View Item keys as document id's.
Then there is a table in the body of every Collapsible Container and it's data source is JS that looks something like this:
formatDataAsArray( => f.document_id == listView.rowKeys[i]

Works like a charm, although if someone know how to improve and/or optimize it, I'll be grateful.