Mapping Specific Attributes

Is there anyway in a Domain Entity to match specific individual attributes ??   In SQL I can create a view and match specific Items from different views or tables, as a business we have had an app created for us which needs some modification.   All I want to do is take a supplier code from one entity and match it to it name in another entity but I cant seem to find a way to do this. Creating an association between the 2 allows me to connect but not match the individual attributes.   What I thought would be a 5 minute job has taken all afternoon and still not progressed.
2 answers

Hi Stephen,


If I understand you in the right way,

Here are a few ways to address your requirements:

1. Association with XPath Constraint:

  • Create an association between the two entities based on the Supplier Code attribute.
  • Use an XPath constraint on the association to filter the related objects based on the Supplier Code.

Example XPath constraint:

(( [SupplierEntity/SupplierCode = $SupplierCode] ))

Where SupplierEntity is the name of the associated entity, and SupplierCode is the attribute you want to match.


2. Microflow with Retrieve Action:

  • Create a microflow that takes the Supplier Code as input.
  • Use a 'Retrieve' action in the microflow to fetch the entity with the corresponding Supplier Code.


3. XPath in Widgets:

  • If you need this information to display in a specific widget, use XPath constraints directly in Mendix widgets like data grids or template grids to filter the data based on Supplier Code.

Choose the approach that best fits your use case and application architecture. It's essential to consider the performance implications and the overall design of your Mendix application. If you face challenges implementing any of these solutions, you may provide more details, and I can offer more specific guidance.


** Kindly  accept my answer if it assist you to solve your problem.


What is the process? When do you want the matching to be done? Is it a validation or matching values?


In any case you need a microflow, which has in object input of the supplier entity. Next retrieve from database of the other entity where [Name = $SupplierCode]

Then the question is

  1. When do you want this to happen?
    1. On commit? > use the save/commit microflow, or if you want to have it happening at ALL times, us a before commit event
    2. Enter of values in the front-end? > use an on-change on your input box
    3. ....
  2. What is the goal of the outcome?
    1. Store the matching? > Add association from supplier to 2nd entity, after retrieve (and found) set association
    2. Validate if it exists? model your microflow accordingly, whatever should happen
    3. ....

Something like this I guess. Got to limited info to give a straight answer.

As you might notice (I hope) I question the process. starting point and goal. This is what Mendix is about, why do you need it. That drives your decisions. And ofcourse it still app development and databases etc... but that's just the resource. The functional app is the goal.