Multiple Reference Selectors Independent From Each Other

1
Hi everyone. I’m having some issues working with reference selectors. I have an entity called truck and another called specific tire. Each truck entity has 18 tire indexes that will be referenced by a specific tire. The problem I’m running into is that I have 18 reference selectors referencing the specific tire id and when I pick one, all the other reference selectors change to that exact same value when I want to be able to pick different ID’s for each index on my truck entity. If anyone can give me a detailed description of how to fix this or a better approach to this, I would greatly appreciate that!
asked
3 answers
0

Hi Andrew,

Because association is between objects, you cannot give individual attributes in an object different associations.

I would normalize the domain model and create an intermediate entity called TrunkTire. It should have an index attribute and associate with tire. 

 

answered
0

Normalizing this database you only need entities Truck and Tire and 18 references from Truck to Tire. This is a result of what you normaly do: Add the nouns of your specs in your domainmodel.

Then generate forms to get the _Overview and _NewEdit-pages. Created the tires, and then in the Truck_NewEdit you can select a specific tire for any of the 18 tire-places available on a truck:

 

There you go. Each reference selector will only affect it's own tire. You still have the problem that each specific tire (Autonumber) should only be allowed having one existing reference of the available 18, since in real life it can only be in one place at the time. Best make a BeforeCommit preventing multiple existing references. But also prevent tires that have an existing reference from showing up in the reference's dropdown by limiting the 'Selectable objects'.

Maybe doing this by micrflow would be better. Or adding a Tire-attribute boolean ‘IsMountedOnATruckSomewhere’ if performance becomes an issue.

In this model each Truck has a fixed (maximum) number of tires. If there is a need to vary the number of tires, you can add attribute NumberOfTires to entity Truck and implement BCo-logic to prevent more than NumberOfTires Tires getting added to a Truck. Don't forget spare-tires if there are any.

 

 

answered
0

Hey Andrew,

Since everyone is posting pictures, so will I. I hope this helps. 

I used your sentence where I see 3 entities and where you state that each truck has 18 tire indexes and each index a specific tire.  (See picture)

This sounds like you need a Reference Set selector Truck can have multiple TireIndex objects and TireIndex object multiple trucks. However each TireIndex has a specific Tire. 

This should slove your problem. At least make sure you got 18 objects in the TireIndex entity and your specific tires are linked to that index.

Good luck, let me know how it went!

answered