Mendix - Getting started with Emp Dept

Anybody who every learned how to build applications on Oracle, probably started with emp-dept. The first step in Oracle Forms usually consisted of building a Master-Detail form for Department and Employees. I thought it would be fun to see how fast i could build an EmpDept master-detail page in Mendix.

In Mendix you start with modeling your domain model. In this case the Department and Employee entities.


Double click on the entity to add attributes and constraints:

Employee attributes

Next we need to add some pages to the mendix project. There are already a number of default pages and modules. This is what the project explorer will look like when we're finished:


Now we can add a new page where we'll create a master detail form showing one departing, and the employees working in that department. First step is to add a template grid. The gray area you see here is the part that is automatically supplied by the template you choose for your page.

Emp dept template grid

Next we need to specify what entity you want to display in the template grid. You can drag and drop an entity from the connector panel to your template grid.


When you drop the entity on your template grid, the modeler will ask you how you want to retrieve the data for this entity. For now we'll choose database, which means that the data will be queries from the database when you open the page.


You now see the entity in your template grid. The modeler will automatically determine all the attributes of the entity, and create fields accordingly,

Template grid dept

I just want to display one department with the employees working in that department. I can configure this for the template grid, by setting the number of rows and number of columns properties both to one.

Template grid rows and columns

Next, we'll create the detail part of the master-detail page. First we add one row by clicking right mouse button on the last row of the table. Then we drag a datagrid in the last row.

Emp dept overview

To display the employees working in the selected department we can drag and drop the employees entity displayed in the connector view connected to the department entity by the Employee_Department assocation.

Emp dept connector

Now you'll see some error regarding missing pages for the Edit and New buttons. You can generate a NewEdit page by right-clicking on one of the buttons, and selecting the generated page for each button.

Last step is to add the DeptEmp page to the navigation, see users can actually open the page. I'll go for the fast route, by changing the home page to the DeptEmp page.


You can now run your application from the modeler. In your browser you will see something like the following page:


As you can see, creating applications using Mendix is a bit like creating applications with a RAD tool like Oracle Forms. Fortunately, Mendix is a bit more advanced than what we had in the 90's. Oracle Forms was mainly focussed on developer productivity, by removing a lot of the technical plumbing programming. Mendix targets the whole software development cycle:

In a next post i'll get into some more details.