I have a tricky find question that I don't know how to resolve.
I have a number of BOs in relationship with each other
A Work must have one or more Author.
A Work must have one or more Owner.
These are controlled by A Contributor BO.
A Contract must have one or more Author.
A Contract must have one or more Owner.
A Contract must have one or more Work.
I need to be able to define a Contract and assign one or more authors and one or more owner.
Once these have been defined I need to be able to filter Works that have all of these Contributors.
For example, if Arthur has written 6 works owned by Peter but only one Work with Anna as author and owned Penelope and Peter, if I create a Contract and add Arthur and Anna as Authors and Peter and Penelope as Owners and the query to add Work to the Contract would be in pseudo code
FIND Work WHERE Work.Contributor = (Arthur and Anna WHERE Work.Participation = Author) and (Peter and Penelope WHERE Work.Participation = Owner)
Where I am struggling is to make the query dynamic enough that the number of Contract parties is not a limiting factor.
TL😃R How do I exclusively match on two sides of m:n relationships