Using Reference Selector to add entity into an attribute of another entity

0
Hello. I’m having problems with working on reference selectors. I have an entity called truck and another called specific tire. Each truck entity has 18 tire indexes that need to be referenced by a specific tire (a separate entity). The problem I’m running into is that I have 18 reference selectors trying to refer to a  specitire id (an attribute on a specific tire) and when I pick one, all the other reference selectors change to that same value. How do i make it so that each different individual spec tire id’s are saved on a truck?
asked
1 answers
1

In your domain model there is only 1 reference to the spec-tire entity. 

When you add multiple reference selectors for the same association these will all be filled by selecting the association in any of the 18 reference selectors as they will all display the same information, namely the association you select with the spec-tire.

To allow for 18 different options you could create 18 associations, 1 for every tire_index and then make sure to add 18 reference selectors, one for every spec_tire association.

Another option could be to add an on change action on the current reference selectors that will set the tire_index attribute with the spec_tire id attribute and clear the reference selector. This means adding 18 different on change actions, one per index field. Not sure if this is what you can do as this is dependent on the use case. In the latter example you create a relation by means of a foreign key construction and can’t use the association to display the details directly e.g.

I hope this helps you in finding a solution and understand the way Mendix associations work a bit better.

answered