How to pass and merge two entity in Mendix

0
Hi,   I am new in Mendix, I am working on one application, I have two different entites  LaptopMaster_DTA LaptopIssueDetails_Data Employee_Master   I want to get EmpCode from employee_master, I want to pull LaptopSerialNo from LaptopMaster_Data and once I get that data I want to save data to Laptop Issue Details table, and want to change LaptopMaster attribute IsActive to True. Sharing screenshots below   After entering employee code I can able to fetch all laptop allocation details related to employee     On click of allocate laptop I am passing EmpCode to next page     In above screen I want to get LaptopSerialNumer from LaptopMaster_Data which IsActive Attribute is false only those serial number should populate, and after click on Save button the attribute value of IsActive attribute should change to True.   I am unable to populate LaptopSerialNumer from LaptopMaster_data and also unable to update  the status of entity in LaptopMaster_data   Any help will appreciate, Thanks In advance     
asked
1 answers
1

Hi Dattatray,

 

I see in the picture and text what the intention is. I’m not sure what the additional fields in your LaptopIssueDetails are for. If you want to assign a Laptop to an Employee it would be enough to have a 1:1 association or a *:1 association (If an Employee can have multiple laptops). 

 

In your Domain Model, you have to copy field values from the LaptopMaster and EmployeeMaster to the LaptopissuedDetailData but you can access those data over the association. I would like to advice you on how to remodel your Domain Model in your use case and to apply the Mendix best practices. (For example Entities should have no underscores as it works confusing as they are used in associations. I would also not add words as Master to EmployeeMaster. Just use Employee, Laptop and would do the trick). You can explain to me like BUCODE as it looks like the business unit on the Employee and we can decide if we just need Laptop and Employee or if there is the need for (an) additional Entity/ies. 

 

The association in your case between Employee *:1 LaptopissueDetail means that you can assign multiple Employees to a Single LaptopissueDetail. I don’t think that that is the case from business logic.

 

If you make associations from one entity to another, keep in mind that you can asses data (single value) from the entity with the * to the 1 entity. When selecting a single Laptop, you can retrieve the assigned LaptopissueDelail. When selecting the Laptops belonging to the LaptopissueDelail, you will get a list (1 or more records) of Laptop.

 

In order not to write you a lengthy reaction, or to point to the Academy (like: https://academy.mendix.com/link/modules/133/lectures/1106/The-Domain-Model), I can offer you an hour of coaching via teams for free. If you want that, send me an email on marco.spoel@t-systems.com.

 

Go Make it.

 

 

 

 

answered