What is the difference between (0 - N) and (M - N) associations?

6
I am not sure exactly what the difference is between a (0 - N) and a (M - N) association. HOw are they different? When should I use one and not the other? Thanks in advance!
asked
2 answers
5

From the wiki:

Between Employee and LeaseCar there is a 0-N relationship. A LeaseCar can have multiple owners and a company can be referenced by multiple LeaseCars; the relationship is recorded in 'LeaseCar'. This is equivalent to an N-M relationship in ERD.

Between Groups and Company there is a N-M relationship. Both Groups and Company can have multiple owners; the relationship is recorded in both Objects.

In practical terms it means you can access both objects from the other object (in microflows) and also use a reference selector to either object in a dataview of the other object. This is not possible in a 0-N relationship where there is only 1 owner.

Edit by Rvh: Also check the wiki page at Associations

answered
4

Technical there is no difference. In the database each relation is a pair table. But for your user interface there are design differences.

When you use a 0-N relation from let's say objA to objB, you can only add the 'Reference set selector' widget in dataviews of objB instances. But when you're using a M-N relation between objA and objB you can also select your reference set in a dataview of objA (again by the 'Reference set selector' widget).

So when it's important that you can select the reference set from dataviews of both connected metaobjects, use the M-N relation. If not, use 0-N. If you're not sure, then use M-N because of, as I say, there is no technical database difference.

answered