Select link with filter OR child table within child table

Using frappe only.
I have “projects” doc, each project has a child table for “phases” ( ie design,build,run,test ). Some projects have many phases and some only have a few. Each phase can have multiple “resources” assigned. ( project manager, developer etc )

I have read that a child form cant have further child forms within it. This is quite a limitation as many complex apps require this multi-level one-to-many nesting

So I attached both the phases and resources docs to the Project doc. But each resource record should be link back to a phase. So I add a phase select in the resources doc. When I do this I get a list of all phases for all projects not just the current ones attched to this projet. So need to "select phases where phase = current docs only phases.

thanks in advance

Maybe hard to understand.? The pick list box should only have one item “everything” in it. But it shows all phases for all projects. “phase 2” and “phase 1” are for a different project. in need to filter the picklist to just phases ( above ) on this project

You need to apply query filter on it using this article,
I have worked a lot on these query filters and can help you further too.
Hope it helps.

It all comes to the query that will return records, and the query depends on the “saved” record, so for example you add a value in phases table and have not saved the form and in resource it will show you the latest saved record only, so you can control it in two ways
Either send the selected phases in a list using JavaScript and return that in query or at the time of saving the form verify that only those phases were selected in resource table that are present in phases table.

Great tip on javascript. User would expect phase on the screen ( before save ) tp be in the picklist.