I am trying to find a solution using macro to import\create relationship between two existing column in different entities.
Default macro's only allows to establish the relationship at entity level, but there is no option to provide the parent and child attributes of that relationship
You might want to check out the sample macro called Import Relationships from Excel. There is a method on the Relationships collection called AddWithRoleName although I have had varying degrees of success with that.
Not sure what you mean about specifying the Parent attribute - that would always be the PK columns from the parent. The only thing you can control is the name of the propogated column in the child table.
If the Parent PK is multiple columns and you don't want them all in the child, you would have to use the 'Hide Key Attribute' on that column in the child table, which is a property of the attribute (HIdden), not the relationship.
Thanks it worked perfectly. I used the existing macro " Import Relationships From Excel" and customized to include the role-name to it
'Set theRel = theModel.Relationships.Add(parentEntName, childEntName, relType)
Set theRel = theModel.Relationships.AddWithRoleName(parentEntName, childEntName, relType,AttrRoleName)
Powered by IDERA