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

Avatar

Avatar
Validate 1
Level 2
akashaj7696
Level 2

Likes

5 likes

Total Posts

29 posts

Correct reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 3
View profile

Avatar
Validate 1
Level 2
akashaj7696
Level 2

Likes

5 likes

Total Posts

29 posts

Correct reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 3
View profile
akashaj7696
Level 2

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
Affirm 100
MVP
_Manoj_Kumar
MVP

Likes

125 likes

Total Posts

329 posts

Correct reply

102 solutions
Top badges earned
Affirm 100
Validate 1
Contributor
Ignite 1
Shape 1
View profile

Avatar
Affirm 100
MVP
_Manoj_Kumar
MVP

Likes

125 likes

Total Posts

329 posts

Correct reply

102 solutions
Top badges earned
Affirm 100
Validate 1
Contributor
Ignite 1
Shape 1
View profile
_Manoj_Kumar
MVP

13-03-2021

@akashaj7696 

 

Try this:

 

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

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
MVP
kapilKochar
MVP

Likes

130 likes

Total Posts

144 posts

Correct reply

45 solutions
Top badges earned
Validate 1
Contributor
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
MVP
kapilKochar
MVP

Likes

130 likes

Total Posts

144 posts

Correct reply

45 solutions
Top badges earned
Validate 1
Contributor
Give Back 10
Give Back 5
Give Back 3
View profile
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