How to log into journal and store open ratio of deliveries using javascript

Avatar

Avatar

akashaj7696

Avatar

akashaj7696

akashaj7696

09-03-2021

Hi Everyone,

 

I'm facing an issue in displaying and storing the value of open ratio using JavaScript. I have used the below code, please let me know where i'm wrong.

 

// query the database to find the winner (best open rate)
var winner = xtk.queryDef.create(
<queryDef schema="nms:delivery" operation="get">
<select>
<node expr="@id"/>
<node expr="@label"/>
<node expr="@internalName"/>;
<node expr="[@operation-id]" alias="operationId2"/>
<node expr="[indicators/@estimatedRecipientOpenRatio]" alias="ratio"/>
<node expr="[indicators/@totalRecipientOpen]" alias="estimated"/>;
</select>
<where>
<condition expr="@internalName='DM187125'"/>
</where>
</queryDef>).ExecuteQuery();

for each (var w in winner){
vars.ratio = w.@ratio;
logInfo("The value of open ratio is " +vars.ratio); - This displays blank.
logInfo(winner); - This displays all the values in the journal.
}

Any help would be appreciated.

 

Thanks,

Akash

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

_Manoj_Kumar

MVP

Avatar

_Manoj_Kumar

MVP

_Manoj_Kumar
MVP

13-03-2021

@akashaj7696 

 

Try this:

 

logInfo("The value of open ratio is " +""+vars.ratio+""); 

Answers (1)

Answers (1)

Avatar

Avatar

kapilKochar

MVP

Avatar

kapilKochar

MVP

kapilKochar
MVP

09-03-2021

Hi Akash,

 

Try this this should work inside for loop and rest of your code is fine

 

for each (var w in winner.ratio)

{
logInfo("The value of open ratio is " + w);
}

 

Thanks,

Kapil Kochar