HI Team,
Scenario : in javascript i have an array of deliveries - for say - "birthday1", "birthday2" and i need to save the statistics of these two deliveries like for : sucessfull sents(based on broadlog table), opt-out(based on tracking table) to a variable of javascript and push them into excel file.
i did like this in javascript :
vars.iteration = getOption("iteration") // initially to 0
var array = ["Birthday_Dynata%Mar%2020" , "Birthday_Dynata%Jun%2020"];
vars.templateName = array[vars.iteration]; //"Birthday_Dynata_MO_AU_Mar 2020";
vars.fromDate = '03/01/2020';
vars.toDate = '03/31/2020';
// through sql i am getting some counts based on template name and dates
vars.success = "select count(*) from NmsBroadLogRcp B1 JOIN NmsDelivery D2 ON (D2.iDeliveryId = B1.iDeliveryId) and "+
"D2.sLabel like '"+ vars.templateName +"' and (B1.tsEvent>='"+ vars.fromDate +"' and B1.tsEvent<='"+ vars.toDate +"')";
vars.succSent = sqlGetInt(vars.success) // success count of Mar emails for 1st iteration
vars.optouts = ".... same as above ...."
vars.optcounts = sqlGetInt(vars.optouts) // opt out counts of Mar emails for 1st iteration
now i want to store these two variables into excel file..
for this i did an enrichment activty :
enrichment : (For example, lets take only one variable here say : success )
This is the test condition :
so the problem is if i don't iterate two time i can export the data like below :
but when i iterate it twice my 'test' is always failing. Seems like i can't able to get my instance variable 'iteration' to validate in test node :
i tried : vars.iteration, instance.vars.iteration also but i can't able to pass this test condition -
Even if test condition is passed i am not sure if i get the second row in excel sheet
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @Ramaswami,
I do not see where you increment vars.iteration, you can do it after your 'data extraction file' with a javascript.
By doing with this workflow, you assume to have x files with just one line. x is the number of iteration.
May be, if you want just one file with x lines, I recommand to create a file and add lines for each sql request you need.
var array = ["Birthday_Dynata%Mar%2020" , "Birthday_Dynata%Jun%2020"];
... // your variables
var f = new File("c:/file.csv")
f.open("a")
for each (item in array)
{
vars.success = "select count(*) from NmsBroadLogRcp B1 JOIN NmsDelivery D2 ON (D2.iDeliveryId = B1.iDeliveryId) and "+
"D2.sLabel like '"+ vars.templateName +"' and (B1.tsEvent>='"+ vars.fromDate +"' and B1.tsEvent<='"+ vars.toDate +"')";
vars.succSent = sqlGetInt(vars.success) // success count of Mar emails for 1st iteration
f.writeln("dataTxt;" + vars.succSent + ";" + vars.fromDate )
}
f.close()
Best regards,
Alexandre Planchot
Views
Replies
Total Likes
Hi Ramaswami, I believe your query has already been answered through this discussion : https://experienceleaguecommunities.adobe.com/t5/adobe-campaign-classic-questions/exporting-variable....
Is this a different query or similar to the previous one ?
Regards,
Sushma
Views
Replies
Total Likes
Views
Replies
Total Likes
Hello @Ramaswami,
I do not see where you increment vars.iteration, you can do it after your 'data extraction file' with a javascript.
By doing with this workflow, you assume to have x files with just one line. x is the number of iteration.
May be, if you want just one file with x lines, I recommand to create a file and add lines for each sql request you need.
var array = ["Birthday_Dynata%Mar%2020" , "Birthday_Dynata%Jun%2020"];
... // your variables
var f = new File("c:/file.csv")
f.open("a")
for each (item in array)
{
vars.success = "select count(*) from NmsBroadLogRcp B1 JOIN NmsDelivery D2 ON (D2.iDeliveryId = B1.iDeliveryId) and "+
"D2.sLabel like '"+ vars.templateName +"' and (B1.tsEvent>='"+ vars.fromDate +"' and B1.tsEvent<='"+ vars.toDate +"')";
vars.succSent = sqlGetInt(vars.success) // success count of Mar emails for 1st iteration
f.writeln("dataTxt;" + vars.succSent + ";" + vars.fromDate )
}
f.close()
Best regards,
Alexandre Planchot
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies