LInking multiple entities into 1 data grid

Given this group of entities: Project - Project team - Project team member A project has 1 or more project teams which has 1 or more team members. Team members can be linked to the entity Employee, which is in fact a foreign key in this case. In a relational DB a child inherits the key of it parents, thus: Project (P-ID) - Project team (P-ID/PT-ID) - Project team member (P-ID/PT-ID/PM-ID) (with PM-ID as the foreign key to Employee (M-ID). With the requirement to show all projects an employee has worked on, you can link from Employee to Project team member, and from there to Project and Project team, as Project team member has the unique (inherited) keys to those entities. Showing data in a data grid with attributes from the 3 Project entities based on the selected employee does not work in Mendix. You could base the data grid on Project team member (data source) to have a direct link to the selected employee, and you can also get data from the Project team entity, but not from the main Project entity. In a grid you can add attributes from the same entity the grid is based on and the next entities linked to that entity by association. And between Project and Project team member there is no direct association. How can we get a data grid with the required data from the 3 entities based on a value from a fourth (Employee)? Or can this be achieved using OQL, even though OGL is not a data source to a widget such as data grids?
1 answers

To get attributes from the 4 entities into 1 grid you'll need an outer dataview with the employee. Inside that dataview add a datagrid of the member entity over the association member-employee (xpath). Now you can select the attributes from member, employee, team and project in one grid. In the project that I used to test this I created a grid of emplyees and a dataview that listen to the grid. Then the dataview itself doesn't show anything except for the grid described above and now I'm able to select an employee in the 1st grid and show all the data from the other entities in the second datagrid. This of course depends on your domain model and association setup. For the setup described above I used:

Member *-->1 Employee
Member *-->1 Team
Team *-->1 Project

Hope this helps in finding a solution for your specific case.