Combined Keys in MDM

Not applicable

Combined Keys in MDM

Hi Guys,
Hope all is well.
In the MDM back end where you great the front end(Model)
You get an UUID or you can use your own key.
But now we need to compose a key from 2 Elements and was wondering how to do that?
For example
We have code and salesorg.
Code = 01
Salesorg = 1000
These 2 elements forms one key?
Thank you,
Jannus
One Star

Re: Combined Keys in MDM

Hello, Jannus,
I managed to do that on Talend MDM Studio 4.2.2.
The resulting XML is something like e.g:
<xsd:element name="Region" type="RegionType">
<xsd:annotation>
<xsd:appinfo source="X_ForeignKey">Region/id</xsd:appinfo>
<xsd:appinfo source="X_ForeignKey_Filter">Region/id$$Contains$$$$#Region/name$$Contains$$$$#</xsd:appinfo>
<xsd:appinfo source="X_Retrieve_FKinfos">false</xsd:appinfo>
</xsd:annotation>
<xsd:unique name="Region">
<xsd:selector xpath="."/>
<xsd:field xpath="name"/>
<xsd:field xpath="id"/>
</xsd:unique>
</xsd:element>
Best regards,
Gil
Not applicable

Re: Combined Keys in MDM

HI Gilf,
Thank you for the quick response.
I copied your code and tried it but was not working.
So with this code it can have 2 keys instead of just the one key?
Thank you,
Jannus
Employee

Re: Combined Keys in MDM

Hi Jannus,
To setup a composite key on an entity :
1. Right-click on the Keys of the entity
2. Select 'New Field'
3. Choose the field you want to add
This will enable you to set the composite key.
But, to ease the use of the entity, I suggest that you setup a single field with a generated key to identify the entities if it's possible.
Hope that helps,
Cyril.
One Star

Re: Combined Keys in MDM

I have an entity with composite key that is made up of a couple of its regular elements and a foreign key. I get the error message "Key field cannot be a foreign key element." What am I doing wrong?
Employee

Re: Combined Keys in MDM

Hi,
This validation message informs you MDM does'nt support having a FK element as part of the ID of your entity (i.e values that are used to define an entity ID must be defined within this entity).