Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

How to create N-N Relation ship link between two schemas on schema level of adobe classic campaign

Avatar

Community Advisor

Hi Team,

We have a requirement of creating a N-N Relation between 2 schemas..but we can't able to get the right syntax to do it.

Can you please guide us to achieve this.

Regards,

Pravallika.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @LakshmiPravallika ,

To create a many to many relationship between table's (schema's) in adobe campaign you need to create an relationship (intermediate) table where you can store the relationship.

A relationship table will be linked 1:N with each table and this will let you link two tables with cardinality N-N. 

The best example of such linking is between OOTB tables "Groups" (nms:group) and "Recipients" (nms:recipient) where "Recipient list contents" (nms:rcpGrpRel)  is the relationship table.

Source schema of the nms:rcpGrpRel table:

<srcSchema entitySchema="xtk:srcSchema" genAccessors="false" img="nms:rcpgroup.png"
           implements="xtk:persist" label="Recipient list contents" labelSingular="Recipient lists content"
           md5="B44333B9AA70F65A87AD3BE34FC9AC9B" name="rcpGrpRel" namespace="nms"
           xtkschema="xtk:srcSchema">
  <element img="nms:rcpgroup.png" name="rcpGrpRel" pkgStatus="never">

    <!-- The index starts by iGroupId since we execute often SELECT iRecipientId ... WHERE iGroupId= -->
    <key internal="true" name="id">
      <keyfield xlink="rcpGroup"/>
      <keyfield xlink="recipient"/>
    </key>

    <dbindex name="recipientId">
      <keyfield xpath="@recipient-id"/>
    </dbindex>

    <element integrity="neutral" label="Recipient" name="recipient" revDesc="Lists to which the recipient belongs"
             revIntegrity="own" revLabel="Lists" target="nms:recipient" type="link"/>
    <element integrity="neutral" label="List" name="rcpGroup" revDesc="Recipients in the list"
             revIntegrity="own" revLabel="Recipients" revLink="rcpGrpRel" target="nms:group"
             type="link">
      <join xpath-dst="@id" xpath-src="@group-id"/>
    </element>
    <attribute label="Foreign key of link 'List' (field 'id')" name="group-id" type="long"/>
  </element>

</srcSchema>


Br,
Shubham


 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @LakshmiPravallika ,

To create a many to many relationship between table's (schema's) in adobe campaign you need to create an relationship (intermediate) table where you can store the relationship.

A relationship table will be linked 1:N with each table and this will let you link two tables with cardinality N-N. 

The best example of such linking is between OOTB tables "Groups" (nms:group) and "Recipients" (nms:recipient) where "Recipient list contents" (nms:rcpGrpRel)  is the relationship table.

Source schema of the nms:rcpGrpRel table:

<srcSchema entitySchema="xtk:srcSchema" genAccessors="false" img="nms:rcpgroup.png"
           implements="xtk:persist" label="Recipient list contents" labelSingular="Recipient lists content"
           md5="B44333B9AA70F65A87AD3BE34FC9AC9B" name="rcpGrpRel" namespace="nms"
           xtkschema="xtk:srcSchema">
  <element img="nms:rcpgroup.png" name="rcpGrpRel" pkgStatus="never">

    <!-- The index starts by iGroupId since we execute often SELECT iRecipientId ... WHERE iGroupId= -->
    <key internal="true" name="id">
      <keyfield xlink="rcpGroup"/>
      <keyfield xlink="recipient"/>
    </key>

    <dbindex name="recipientId">
      <keyfield xpath="@recipient-id"/>
    </dbindex>

    <element integrity="neutral" label="Recipient" name="recipient" revDesc="Lists to which the recipient belongs"
             revIntegrity="own" revLabel="Lists" target="nms:recipient" type="link"/>
    <element integrity="neutral" label="List" name="rcpGroup" revDesc="Recipients in the list"
             revIntegrity="own" revLabel="Recipients" revLink="rcpGrpRel" target="nms:group"
             type="link">
      <join xpath-dst="@id" xpath-src="@group-id"/>
    </element>
    <attribute label="Foreign key of link 'List' (field 'id')" name="group-id" type="long"/>
  </element>

</srcSchema>


Br,
Shubham


 

Avatar

Community Advisor

Hi Subham,

 

I didn't understand one Part in the N-N Link actually.

 

How is the column below getting populated to make the N-N Link work?

 

    <attribute label="Foreign key of link 'List' (field 'id')" name="group-id" type="long"/>

 

Could you Please let me know?

 

Regards,

Pravallika.