Filtering records in a browser screen

Good day team,

I am trying to filter records in a browser screen based on the screen from which the browser is called.

Example

I have entity Project that has a one-to-many composition relation with entity Employee. In my Project edit screen i have an employee table with actions add and remove which allows me to add or remove employees to or from a project.

Entity Employee has an attribute status which is set to available when employee has not been added to any project and set to unavailable when they have been added to a project.

My challenge is when i click the add button (with add action) the Employee’s browser screen is opened showing every employee record.

I would want only the employee with available status to show when the employee browser is opened from the project edit screen But show everything when the employee is open from the mainWindow.

How can i achieve this, thank you in advance

Hi @mabutabee,

If you are using v6, in ProjectEdit.java, use setWindowParams in the AddAction. Then in employee-browse.xml, use the param provided to filter.

If you are using v7, the approach is almost the same. Look the links below.
https://doc.cuba-platform.com/manual-latest/datasource_query_filter.html
https://doc.cuba-platform.com/manual-latest/gui_data_loaders.html
https://doc.cuba-platform.com/manual-latest/gui_data_comp_param.html

Regards.

2 Likes

Hi @peterson.machado,

Thank you so much for your help, just the right solution to my problem.