Expand my Community achievements bar.

SOLVED

Hi All, Please help me with the segment code

Avatar

Level 1

Hi All,

When i'm executing a delivery, i'm unable proceed without a segment code(Targeting activities like split, union and intersection has separate segment code).

I come up with two solution for this.

1. I can make the segment code as mandatory field in the Out of Box form(OOB Form). But it might affect my existing campaign/deliveries that doesn't have segment code.

2. I can apply typology rule to exclude the recipient who doesn't have the segment code. Since Split, Union activities segment code are in stored in temporary table. any idea to fetch the data from temporary table? refer the 3rd image  (I would like to go with 2nd option).

I have attached 3 images. my sample work flow.

segment.PNG

Split activity where we can find segment code.

Capture.PNG

Temp table of split activity.

temp-table.PNG

Little help on this much appreciated.

Thanks

Soma

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi Soma,

I don't think we can create a typology based on the Segment Code, as this column comes in Temporary Schema and it's not saved in the database. Typology Rules can only be created on the columns which are in the Database Schemas or you can write one JavaScript code. But the problem in writing the JS is that you can check whether the recipients have SegmentCode value or not but you can't filter them out.

There may be some way to create Typology for this, but I am not aware of that.

So, if you want to send delivery only to the recipients who have Segment Code value, one solution can be :

Yes, you are correct that each activity has it's own Segment Code.

But, all the Segment Codes have same Alias as well as Column Name in the Temp Schema i.e. Segment code (@segmentCode).

So, before the delivery you can have one split activity, in which you can filter out the recipients who have Segment Code as Empty and send the delivery to only those which have Segment Code value populated.

View solution in original post

6 Replies

Avatar

Employee Advisor

Hi Soma,

Can you please tell me what exactly is the error you are getting while executing the delivery without the Segment Code, because Segment Code is not a mandatory thing for the delivery to execute ?

Avatar

Level 1

Hi Kapil,

Thanks for jump in. I want to make the segment code as mandatory for delivery. Recipient who is having segment code, he/she should get the delivery, that is my acceptance criteria.  I need to do it by applying typology rule. Since the segment codes are unique to every activities, split, union, intersection, I wonder how to apply typology here.

Avatar

Correct answer by
Employee Advisor

Hi Soma,

I don't think we can create a typology based on the Segment Code, as this column comes in Temporary Schema and it's not saved in the database. Typology Rules can only be created on the columns which are in the Database Schemas or you can write one JavaScript code. But the problem in writing the JS is that you can check whether the recipients have SegmentCode value or not but you can't filter them out.

There may be some way to create Typology for this, but I am not aware of that.

So, if you want to send delivery only to the recipients who have Segment Code value, one solution can be :

Yes, you are correct that each activity has it's own Segment Code.

But, all the Segment Codes have same Alias as well as Column Name in the Temp Schema i.e. Segment code (@segmentCode).

So, before the delivery you can have one split activity, in which you can filter out the recipients who have Segment Code as Empty and send the delivery to only those which have Segment Code value populated.

Avatar

Level 2

I tried to write a typology as well using JS which queries the segment code field. This code works within a workflow, but not within the typology rule. If the segment code isn't populated at all, there is no field to query.. so i added a catch. That being said I cannot seem to query target data from within a typology rule, it just fails everytime. @Jonathon_wodnicki any ideas?

 

Here is my typology rule code:

 

try {

    var query= xtk.queryDef.create(

            <queryDef schema={vars.targetSchema} operation="count">

                <select>

                    <node expr="@segmentCode"/>

                </select>

                <where>

                   <condition expr={"@segmentCode = ''"}/>;

                 </where>

            </queryDef>)

           

     if( query.ExecuteQuery().@count > 0 )

        

         {

         

         //Segment code is not populated for all records in the target data. Trigger the typology = return false

         return false;

         }

         else

         {

           //No empty segment codes. Do not trigger typology = return true

           return true;

         }    

        }

        catch(e) {

          //No segment code for any of the records. @segmentCode cannot be queried. Trigger the typology = return false

          return false;

        }

Avatar

Community Advisor
Change {vars.targetSchema} to "nms:tmpBroadcast". Also add a target mapping for segment code to broadlog if it's not already there.

Avatar

Level 2
it worked! thank you. And of course to the target mapping