Types of Table Cardinality in D365 F&O
Table of Content:
Types of Table Cardinality in D365 F and O
Table Cardinality explained
In this example we take an example of the relation between SalesTable, which is the parent table and the salesLine, which is the childTable.
Both tables have a unique relationship and the related field is the SalesId field. I try to explain the meaning of the Cardinality and RelatedTableCardinality on the child table (SalesLine).
Cardinality
This property is looking to the relation of the field of the related table has with the related field of the current table which has the relation defined. For example we are looking which relation the SalesId field in the SalesTable has with the SalesId field in the SalesLine. We see that the RelatedCardinality is “ZeroMore”
ZeroMore (0 or N) said that a SalesId we see in the salesTable could not exists or could occur in more than one records in the salesLine with the same SalesId (which is the defined related field). Both conditions are correct. A SalesId we see in the salesTable does not necessarily has a related record with the same SaledId in the SalesLine table. At the other hand we can see more records in the salesLine table with the same SalesId of the Salestable. Both conditions are true.
Other options we have: ExactlyOne, ZeroOne and OneMore are not correct for describing the cardinality.
ExactlyOne (1 : 1) said that the SalesId in the SalesTable exactly has always one record in the SalesLine with the same SalesId. Despite that this description could occur, it’s wrong to use this as cardinality because it not complete in describing the cardinality. A SalesId of the salestable could also not be available in the SalesLine or could occur in more records.
ZeroOne (0 or 1) said that a SalesId in the Salestable table could not exists or could occur in one record with the same SalesId in the SalesLine. First condition is true, but the second is not, because we can see more records with the same SalesId of the SalesTable in the SalesLine table.
OneMore (1 or N) said that a SalesId in the Salestable could have one record in the salesLine with the same SalesId or could have more records in the salesLine with the same SalesId. Both conditions are correct, but statement is not complete because this condition implies that there are always should at least one record available in the salesLine table with the same SalesId as we found in the SalesTable. This is not true because it is also possible that we don’t see a SalesId from the SalesTable in the SalesLine. For example if we create a salesOrder without order lines.
“Cardinality” as property of the SalesTable relation of the SalesLine table
In this picture you can see the types of Cardinality. |
RelatedCardinality
property is looking to the relation of the related field between the current table with field of the related table defined in the relation. For example we are looking which relation the SalesId field in the SalesLine has with the SalesId field in the SalesTable. We see that the RelatedCardinality is “ExactlyOne”.
ExactlyOne (1 : 1) said that the SalesId in the SalesLine table exactly has always one record in the SalesTable with the same SalesId (related field defined in relation).
The other options ZeroOne, ZeroMore and OneMore are not correct for describing the RelatedCardinality:
ZeroOne (0 or 1) said that a SalesId in the SalesLine table could not exists or could occur in one record with the same SalesId in the Salestable. This is incorrect because a SalesId in the salesLine should always occurs in one record of the salesTable with the same SalesId, so the first part of this condition is not correct.
ZeroMore (0 or N) said that a SalesId we see in the salesLine could not exists or could occur in more than one record in the salesTable with the same SalesId. Both conditions are incorrect. A SalesId we see in the salesLine has always one related record with the same SalesId in the Salestable
OneMore (1 or N) said that a SalesId in the SalesLine table could have one record in the salesTable with the same SalesId or could have more records in the salesTable with the same SalesId. The second part of the condition is incorrect, because as we see earlier there is always one record in the salestable with the same SalesId.
“RelatedCardinality” as property of the SalesTable relation of the SalesLineTable.
In this image you can see the related table cardinality types |