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?
Solved! Go to Solution.
Views
Replies
Total Likes
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
Hi @A_B_SE ,
In the delivery activity > script create the below instance variable
instance.vars.myDeliveryCode = delivery.deliveryCode;
In split activity, you can call this delivery code as $(instance/vars/@myDeliveryCode)
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:
When i hard-code the value it works as usual:
When trying apply your rule:
Do you know why it doesn't work for me?
Views
Replies
Total Likes
@A_B_SE , Are you using this split in the downstream transition of the delivery (After delivery)?
Views
Replies
Total Likes
No I'm using it before delivery since I need to exclude customers based on the delivery they are going to receive.
Views
Replies
Total Likes
Any other suggestion?
Views
Replies
Total Likes
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
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!
Views
Replies
Total Likes