Hi,
can someone explain me how to automate the creation of segment codes? Cant find any documentation about it...
Maybe using javascript?
Thank you and kind regards,
Blanca
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @bcollado ,
Go to Split activity > Advanced tab > paste the below script in initialization script
vars.subset1_variable = formatDate(new Date(), "%4Y/%2M/%2D");
vars.complement_variable = formatDate(new Date(), "%4Y");
//for Subset 1
activity.transitions.extractOutput[0].code = vars.subset1_variable;
//For complement segment code
activity.transitions.remainder.code = vars.complement_variable;
The above script will automate segment code by adding current date to subset 1 and current year in complement's segment code. Instead of current date and year, replace it with your logic and store in the same above variable and run the workflow.
If you have multiple subsets, then add one more line and modify it as extractOutput[1], extractOutput[2] and so on...
//Subset 1
activity.transitions.extractOutput[0].code = vars.subset1_variable;
//Subset 2
activity.transitions.extractOutput[1].code = vars.subset2_variable;
//Subset 3
activity.transitions.extractOutput[2].code = vars.subset3_variable;
//Subset 4
activity.transitions.extractOutput[3].code = vars.subset4_variable;
//Complement
activity.transitions.remainder.code = vars.complement_variable;
Hi @bcollado ,
Go to Split activity > Advanced tab > paste the below script in initialization script
vars.subset1_variable = formatDate(new Date(), "%4Y/%2M/%2D");
vars.complement_variable = formatDate(new Date(), "%4Y");
//for Subset 1
activity.transitions.extractOutput[0].code = vars.subset1_variable;
//For complement segment code
activity.transitions.remainder.code = vars.complement_variable;
The above script will automate segment code by adding current date to subset 1 and current year in complement's segment code. Instead of current date and year, replace it with your logic and store in the same above variable and run the workflow.
If you have multiple subsets, then add one more line and modify it as extractOutput[1], extractOutput[2] and so on...
//Subset 1
activity.transitions.extractOutput[0].code = vars.subset1_variable;
//Subset 2
activity.transitions.extractOutput[1].code = vars.subset2_variable;
//Subset 3
activity.transitions.extractOutput[2].code = vars.subset3_variable;
//Subset 4
activity.transitions.extractOutput[3].code = vars.subset4_variable;
//Complement
activity.transitions.remainder.code = vars.complement_variable;
Thank you very much!!
have a nice day
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies