Expand my Community achievements bar.

SOLVED

Personalization : Fields has relation with recipient table

Avatar

Level 4

I have data such as

brData

BR_Code  BR_Name BR_Manager_Name  BR_Manager_EMAIL_ID     BR_Manager_Phone# 

A               B                    C                    a1@gmail.com                   9123333333

X               Y                    Z                    b1@gmail.com                    9123333331

P               Q                    R                    c1@gmail.com                   9123333332

A               R                    Y                    r1@gmail.com                    9123333336

A               T                    Z                    t1@gmail.com                    9123333335

BR_Code remains constant but other details keeps changing (in a day or two).

Recipient Schema has customer email id & @text1 field of recipient  table has BR_Code so that it can be mapped with brData .

When I query Targeting dimension as Recipient & Filtering Dimension as brData and condition as BR_Code = 'A',it returns all customers in Recipient table with BR_Code as A but when I try to personalize BR_Manager_Name or BR_Manager_EMAIL_ID or BR_Manager_Phone# 

it returns undefined.

The syntax I have used in delivery to personalize is <%= recipient.brdata_Recipient.BR_Manager_Name %>.

When I use <%= recipient.text1 %> for Branch Code, it works perfectly fine but <%= recipient.brdata_Recipient.BR_Manager_Name %> is not working.

What I am missing here?

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi Chandni,

You have to define revCardinality ="Single" for direct access of this data in delivery. below is the code

    <element externalJoin="true" label="Recipient" name="recipient" target="nms:recipient"

             type="link"  revCardinality ="Single">

      <join xpath-dst="@text1" xpath-src="@brCode"/>

    </element>

But, I think it might create a issue for you. You have defined brCode as primary key for you Br_data schema, by due this you are defining that each and every recipient will have different brCode, recipient can't share br Code. Adove code will define 1-1 cardinality between Recipient & BR_Data.

If multiple recipient can share same br code, than you need to define link with below code using unbound= "true", this might solve your problem

    <element externalJoin="true" label="Recipient" name="recipient" target="nms:recipient"

             type="link"  revCardinality ="Single" unbound="true">

      <join xpath-dst="@text1" xpath-src="@brCode"/>

    </element>

Hope, it make sense.

Regards,

Ankur A.

View solution in original post

7 Replies

Avatar

Level 10

Hi,

I am not sure I understand the data model here. Can you confirm that all your data (including custom fields) are part of the recipients table? Or do you use a different table - related to the recipients table - to store the brData?

Let me know,

Florent

Avatar

Level 4

brData is another Data Schema which is linked with recipient table with key as text1 of recipient table = brCode column of brData table

Avatar

Level 3

Hi,

Can you please also let us know the Cardinality between recipient and BR_Code schema ?

It might be to do with the cardinality, if you have 1-1 or N-1 cardinality from Recipient to BR-Code you can use it directly it in delivery. Otherwise you to enrich it using enrichment activity first and than use it as targetdata in delivery.

Also, make sure you use correct link name also.

Regards,

Ankur A.

Avatar

Level 4

Hi Ankur,

BR_data schema is a table storing master branch codes( BR_Code).

BR_Code  BR_Name BR_Manager_Name  BR_Manager_EMAIL_ID     BR_Manager_Phone#

A               B                    C                    a1@gmail.com                   9123333333

X               Y                    Z                    b1@gmail.com                    9123333331

P               Q                    R                    c1@gmail.com                   9123333332

Multiple recipients can have same BR_Code.

I am storing BR_Code in text1 field of recipient table.

In br_Data schema, I have created Join as below:

    <element externalJoin="true" label="Recipient" name="recipient" target="nms:recipient"

             type="link">

      <join xpath-dst="@text1" xpath-src="@brCode"/>

    </element>

    <key internal="true" name="brDetailsKey">

      <keyfield xpath="@brCode"/>

    </key>

Using enrichment, I am able to personalize the delivery. I am looking to do it directly through br_Data table in the delivery for the sake of simplicity.

I can make changes in br_Data schema if this is limiting me in anyway in directly personalizing the delivery.

Thanks,

Chandni

Avatar

Correct answer by
Level 3

Hi Chandni,

You have to define revCardinality ="Single" for direct access of this data in delivery. below is the code

    <element externalJoin="true" label="Recipient" name="recipient" target="nms:recipient"

             type="link"  revCardinality ="Single">

      <join xpath-dst="@text1" xpath-src="@brCode"/>

    </element>

But, I think it might create a issue for you. You have defined brCode as primary key for you Br_data schema, by due this you are defining that each and every recipient will have different brCode, recipient can't share br Code. Adove code will define 1-1 cardinality between Recipient & BR_Data.

If multiple recipient can share same br code, than you need to define link with below code using unbound= "true", this might solve your problem

    <element externalJoin="true" label="Recipient" name="recipient" target="nms:recipient"

             type="link"  revCardinality ="Single" unbound="true">

      <join xpath-dst="@text1" xpath-src="@brCode"/>

    </element>

Hope, it make sense.

Regards,

Ankur A.

Avatar

Level 10

Hi Chandni,

As you have not specified the revCardinality so default cardinality is unbound so you can use the direct access in your delivery.

Now you have two options:

1. You have to define revCardinality ="Single" for direct access to this data in delivery. suggested by @ankur

2. You can use following code to access manager name in delivery.

<%= recipient.brdata_Recipient[0].BR_Manager_Name %>

Assumption: every recipient will have different BR code.

If this is not the case then use

<%

for( var i=0; i < recipient.brdata_Recipient.length; i++){

//condition to get the correct Br code anything can go here based on your requirement

if( recipient.brdata_Recipient[i].brCode =="testName"){

%>

<%= recipient.brdata_Recipient[i].BR_Manager_Name %>

<%}

}%>

Hope this helps!

Amit

Avatar

Level 4

Many thanks Ankur. It worked for me !!