CMDBuild Forum

Creating Foreign Key Attributes

So I may not have a full understanding of how domains and cardinality work yet. However, I do understand that the reference attribute must be created on the class at the N side of the 1:N or N:1 domain.

With this in mind, I would like to create multiple reference attributes referencing specific attributes in the class from the '1' side of the domain.

E.g. 

Class A

A Attribute 1

A Attribute 2

A Attribute 3

 

Class B

B Attribute 1

B Attribute 2

B Attribute 3

 

Domain: 1:N (Origin Class A, Target Class B)

 

Now, I want to add a reference attribute to point to Class A Attribute 2 and an additional reference attribute to point to Class A Attribute 3. How do I do this? 

Currently when I add a reference attribute to Class B it will only reference data held within the "Description" attribute.

Many Thanks,

Jamie

Hi Jamie,

 
in a card it is only possible to reference the Id of another card. Foreign keys in relational databases always point to the key column (or set of columns that form the key), and the Id is basically the key attribute for a card. In the web form it will be displayed as the Description attribute of the referenced card. This can be done in two ways:
  1. reference attribute over a domain (on the N side, one different domain for each reference) for standard classes
  2. foreign key for simple classes
Anyway I don't get if you just want another attribute to be displayed instead of Description, or if it something more complex that I didn't undertand.
 
Paolo