Combine string parameters within a entity for a datagrid

0
I am BRAND new to mendix so apologize for the fairly entry level question here.  Going through the introduction course as well but I am at the same time playing with a basic functionality application. I have a "Person" entity with a few generic parameters, FirstName LastName, EmailAddress to start off with I made an "Employee" entity generalized with the person entity in my domain model. I also have a "Project" entity with a 1 to many relationship pointing to employees and this variable created is my ProjectOwner On the Project_Overview datagrid I want to have a column indicate who my projectowner is.  I can pull the employee first name or last name and list them as two seperate columns.  But for readability I want to put them together..... How do I do this?  Do I need to create a microflow?  I started playing with that but dont know how to link it to the datagrid.   I am thinking it is best to leave the entity parameters seperate by first and last name in case I want to deal with sorting in the future.     Thoughts?
asked
1 answers
1

Ivan,

You would need to create a microflow to combine first name and last name and populate that value into the full name attribute you'll add to the entity.  This microflow could be called in one of 3 ways:

  1. As an On Change event on the First Name and Last Name text boxes on the page where you edit employees
  2. As an Event Handler on the entity (probably before commit)
  3. As a calculated Attribute on the entity

 

For this use case, 1 is the preferred option IMO, because this information will change infrequently so you are incurring the cost to update only when needed.  2 would update the full name every time an employee is committed, not wrong but incurring unneeded cost because the employee's first and last name won't change every time the employee is committed.  3 is the least preferred option because the microflow will execute every time an employee is retrieved, for instance when you view a list of employees, the microflow will execute for each employee, so 3 is the most costly option.

Hope that helps,

Mike

P.S. if you anticipate these employees logging in to your app, you should set them up as a specialization of System.User or Administration.Account as this will create these employees with the ability to login.  This opens up a number of other things that need to be taken into consideration regarding user security and user creation.  For a good example of this in action, download and view the Employee Directory app from the App store.  It has an Employee entity with Full Name and an event handler that populates that attribute.  It will also give you some examples of how to create users and manage user security.  For an intro to some of these topics, you can read this how to: https://docs.mendix.com/howto6/create-a-secure-app

answered