Personalization : Fields has relation with recipient table

ckumari12

02-08-2017

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?

Accepted Solutions (1)

Accepted Solutions (1)

_nkur

03-08-2017

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.

Answers (6)

Answers (6)

Amit_Kumar

MVP

07-08-2017

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

ckumari12

03-08-2017

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

_nkur

03-08-2017

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.

florentlb

02-08-2017

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