Expand my Community achievements bar.

SOLVED

Exclude customers based on delivery they are going to get

Avatar

Level 4

Hello,

I have a tricky question. I have a target group that will get an email and this email has a certain delivery code. I would like to exclude customers based on that delivery code of the delivery they are going to get without hard-coding it in a split.

 

For example:

Recipient logs doesn't exist such as delivery code = "delivery code of the delivery at the end of the wkf"

 

Is it possible to do it with a JS code or maybe through typology rules?

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi @A_B_SE ,

 

I have a simple suggestion for you, why not try using queryDef on the temp table and then exclude the data with the WHERE clause?

For this you can do the following steps:

1. Declare a column that says @exclude  in additional data (like Query, enrichment) before the Js.

2. Create a Js activity and do queryDef on the incoming temp table with WHERE:

var del = xtk.queryDef.create(
<queryDef schema="temp:<your temp table name>" operation="select" lineCount="1000000">
<select>
<node expr="@id"/>
<etc>
<etc etc .. what feilds you need>
  <where> <condition expr="@nature NOT LIKE %VÄLKOMNA%"/> </where>
</queryDef>
).ExecuteQuery();

3. For these outputs of recipients Id's (rows) you can update this new "@exclude" field with 'Yes' or 'No' using the WRITE function in for each loop.

4. Next you can now add a 'Split' or 'Test' activity and remove the recipients with the field @exclude as 'Yes' or 'No'.

 

Steps 1 & 3 are explained in more detail in one of my answers in past: link

 

Br,

Shubham

View solution in original post

7 Replies

Avatar

Community Advisor

Hi @A_B_SE ,

In the delivery activity > script create the below instance variable

instance.vars.myDeliveryCode = delivery.deliveryCode;

ParthaSarathy_0-1667398758000.png

 

In split activity, you can call this delivery code as $(instance/vars/@myDeliveryCode)

ParthaSarathy_1-1667398888226.png

 

 

Avatar

Level 4

Thank you, I tried but it doesn't seem to work. I'm trying to filter on DelCode_5_Syfte:

 

My test customers delivery logs has deliveries with DelCode_5_Syfte = VÄLKOMNA:

alberto_bodini_0-1667464012764.png

When i hard-code the value it works as usual:

alberto_bodini_1-1667464189307.png

alberto_bodini_2-1667464259138.png

When trying apply your rule:

alberto_bodini_3-1667464300244.pngalberto_bodini_4-1667464337276.pngalberto_bodini_5-1667464356745.pngalberto_bodini_6-1667464418329.pngalberto_bodini_7-1667464449092.png

Do you know why it doesn't work for me?

 

 

 

 

Avatar

Level 4

No I'm using it before delivery since I need to exclude customers based on the delivery they are going to receive.

Avatar

Correct answer by
Level 7

Hi @A_B_SE ,

 

I have a simple suggestion for you, why not try using queryDef on the temp table and then exclude the data with the WHERE clause?

For this you can do the following steps:

1. Declare a column that says @exclude  in additional data (like Query, enrichment) before the Js.

2. Create a Js activity and do queryDef on the incoming temp table with WHERE:

var del = xtk.queryDef.create(
<queryDef schema="temp:<your temp table name>" operation="select" lineCount="1000000">
<select>
<node expr="@id"/>
<etc>
<etc etc .. what feilds you need>
  <where> <condition expr="@nature NOT LIKE %VÄLKOMNA%"/> </where>
</queryDef>
).ExecuteQuery();

3. For these outputs of recipients Id's (rows) you can update this new "@exclude" field with 'Yes' or 'No' using the WRITE function in for each loop.

4. Next you can now add a 'Split' or 'Test' activity and remove the recipients with the field @exclude as 'Yes' or 'No'.

 

Steps 1 & 3 are explained in more detail in one of my answers in past: link

 

Br,

Shubham

Avatar

Administrator

Hi @A_B_SE

Were you able to try @Shubham_Goyal__'s proposed solution? Let us know if it helped you resolve your issue or if you need more help with your query.

Thanks!



Sukrity Wadhwa