JS activity: Array of objects to use in Alert activity
Hi all!
I am working on a JS activity that will fetch the mirror page of specific deliveries. I have now succesfully queried the given deliveries and stored them in a JS array containing objects. Now comes the part where I want to access these objects in a delivery, but I am not sure how to convert the array into meaningful data to reference from a delivery.
I tried to simply do: vars.myArray = Array[object]. but this does not work, it seems like the "vars.xx" is not ablle to just convert the js variable.
Here is my code so far:
var deliveries = ["'play_win_v3_eml_1_a.a_'","'play_win_v3_eml_1_b.a_'","'play_win_v3_eml_1_c.a_'","'play_win_v3_eml_1_d.a_'","'play_win_v3_eml_1_e.a_'","'play_win_v3_eml_1_f.a_'"];
var mirrorUrls = [];
for each (var del in deliveries){
var query = xtk.queryDef.create(
<queryDef schema="nms:broadLogRcp" operation="get" lineCount="1">
<select>
<node expr="@id"/>
<node expr="@eventDate"/>
<node expr="[delivery/@id]"/>
<node expr="[delivery/@deliveryCode]"/>
</select>
<where>
<condition expr={"[delivery/@deliveryCode]="+del}/>
</where>
<orderBy>
<node expr="@eventDate" sortDesc="true"/>
</orderBy>
</queryDef>
)
var result = query.ExecuteQuery();
var obj =
{
"name": result.delivery.@deliveryCode,
"eventDate": result.@eventDate,
"id": result.@id,
"url": nms.delivery.GetMirrorURL(result.delivery.@id, result.@id)
};
mirrorUrls.push(obj);
};
vars.mirrorUrlArray = mirrorUrls;
for each (var instance in mirrorUrls){
logInfo("name: " + instance.name);
logInfo("date: " + instance.eventDate);
logInfo("url: " + instance.url);
} I need to somehow be able to fetch the value of each object in my delivery - How can I reach that goal?
Any help would be much appreciated!!