Need direction on developing Domain Model and linking it to fields on my page

0
Hi, I’m new to Mendix and been struggling to find documentation to assist me. I have some questions I’m hoping someone would be willing to help me with.  When I look at examples in Domain Models, I notice the data is linked by associations (1-to-many, etc.), however, I’m not seeing any options to tell Mendix which fields to link the data to (i.e. identify “primary” and/or “secondary” keys). Since we aren’t linking the data by keys, I’m struggling to see how Mendix knows which data is supposed to link together?  For example, on my page, the first field I want the customer to fill out is called “Event Type”.  I have a drop-down tied to an enumerated field.  Based on the value they select in the “Event Type”, I want the next field called “Movement Code” to provide a “filtered” list of codes/options that are tied to that specific event type.  So, this question is about how I properly link data because I have some scenarios where I need to use both a primary and secondary key to filter to a specific list.  With the example provided in the question above, what is the recommendation when it comes to entities?  Can I put both sets of data into 1 entity or should I build 2 entities, one for “Event Type” and one for “Movement Code”?  If 2 separate, then do I need to make sure the primary key (attribute) exists in both entities? In the app, I will use a combination of both external data and internal data.  How do I upload the internal data that I want to show up in my drop-down lists?  I already set up the entity, attributes and specified the values for the enumerated fields, but I will have multiple combinations of this data that I need uploaded into the entity.  I’m struggling to find documentation on how to do this.  I saw the documentation on how build an app from a spreadsheet, but in my case, the app is already built (I’m just adding new functionality to something someone else built.)
asked
2 answers
0

In general you don’t have to think about Primary keys at all. Mendix automatically generates these keys in the background (Datatbase).
Hey it’s low code! :-)

https://docs.mendix.com/refguide/entities/

 

Question 1

  1. Many options ofcourse. This is the first i was thinking of:
  2. Create overview pages for all 3 entities.
    First create EventTypes, then Movement Codes, then try to add a CustomerProject.
  3. Based on XPATH you can limit the options for MovementCodes based on the EventTypes.

 

You can also add an Microflow to influence the results.

Result:

 

Question 2

You can also create xpaths based on Enums in stead of Entities. I would prefer Entities to expand these in the future.

 

Question 3

Try to use the Excel Importer module from the appstore.

Here you can import data directly to the database. You can also connect microflows to certain colums to set associations to other entities.

 

answered
0

Hi Mandy Fulton,

Welcome to mendix. In the mendix academy there are some learning paths where you can train and learn more about developing an app:
https://academy.mendix.com/link/home

Answering to your questions:
1. To understand more about associations please see the following documentation:
https://docs.mendix.com/refguide/association-properties/ https://docs.mendix.com/refguide/association-member-properties/#type https://docs.mendix.com/refguide/association-member-properties/#owner https://docs.mendix.com/studio/domain-models-association-properties/
https://forum.mendix.com/link/questions/114119
2. It depends on the multiplicity of the association. If it is one to many you should buid two separate entities. For instance if the event type can have many movement codes. The many will be on the entity event type side. In mendix you don’t have to worry about keys (after reading the documentation above you will understand)


 

answered