Filter N-N selection screen based on attribute

I have many to many relationship in two entities A & B. Both entities have one same attribute “Regulation”. While adding A data, I want B selection browse screen to be filtered by “Regulation” attribute added in A.

How can I do this?

Thanks

I am able to do this by subscribing add action for B table in A entity edit and using parameter in browse screen of entity B with dataloader setparameter.

But when i go to browse screen of B directly it is not showing any data as parameter is null.

I have used this jpql in B browse screen-

![CDATA[select e from sheellegal_MasterLegalText e where e.regulation =:MyRegulation order by e.position]]>

How can i set that if MyRegulation parameter is null then it shows all records?

Hi,
You need to place your condition by e.regulation to a separate c:where query fragment section.
Then it will be omitted if the MyRegulation parameter is null.

See example here in the documentation:
https://doc.cuba-platform.com/manual-7.2/gui_data_loaders.html#gui_data_loader_query_conditions

These fragments are added to the resulting query text only when all parameters used in the fragments are set for the query .