Second Highest Winning Delivery Needs to be Deployed

Avatar

Avatar
Validate 1
Level 1
mustufam5967803
Level 1

Likes

2 likes

Total Posts

15 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
mustufam5967803
Level 1

Likes

2 likes

Total Posts

15 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
mustufam5967803
Level 1

05-02-2019

Hi Team,

I have a condition where I have four Deliveries and I need to deploy to the Second highest Open rate delivery.

The logic I am using is : A/B testing

Can you help me with the JS code that will pick the second winining delivery based on Open rate.

Thanks in Advance!

[ duplicate thread ] --> Second Highest Winning Delivery Needs to be Deployed

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

07-02-2019

You didn't select @internalName in the query. Use a simple counter here:

var winner, i = 1;

for each (var row in res) {

    if (i++ === 2) winner = row;

}

Answers (6)

Answers (6)

Avatar

Avatar
Validate 1
Level 1
mustufam5967803
Level 1

Likes

2 likes

Total Posts

15 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
mustufam5967803
Level 1

Likes

2 likes

Total Posts

15 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
mustufam5967803
Level 1

06-02-2019

Hi Wodnicki,

The code I  am using is as follows:

  var winner = xtk.queryDef.create(

  <queryDef schema="nms:delivery" operation="select">

       <select>

         <node expr="@id"/>

         <node expr="@label"/>

     <node expr="@internalName"/>

       </select>

       <where>

        <condition expr={"@FCP=0 and [@internalName] in ('em123','em124','em125','em126') and @isModel=0"}/>

       </where>

       <orderBy>

         <node expr="[indicators/@estimatedRecipientOpenRatio]" sortDesc="true" />       

       </orderBy>

     </queryDef>)

    res = winner.ExecuteQuery();

   

for each (var row in res)

{

     logInfo(row.@internalName)

     }

I tried reading the rows through for each, not getting the seond highest delivery internal name though, please help ASAP.

Regards,

Mustufa

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

06-02-2019

Could you paste your code that's failing, with the error?

Avatar

Avatar
Validate 1
Level 1
mustufam5967803
Level 1

Likes

2 likes

Total Posts

15 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
mustufam5967803
Level 1

Likes

2 likes

Total Posts

15 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
mustufam5967803
Level 1

06-02-2019

Hi Wodnicki,

Can you help me withe the code to iterate the result and stop at second row.

I tried with For Each loop but getting some error.

Regards,

Mustufa

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

05-02-2019

Hi,

Change the js so instead of operation="get" it's operation="select", for:

// query the database to find the winner (best open rate)

  var winner = xtk.queryDef.create(

  <queryDef schema="nms:delivery" operation="get">

Then iterate over the results, stopping at the second row.

Thanks,

-Jon

Avatar

Avatar
Validate 1
Level 1
mustufam5967803
Level 1

Likes

2 likes

Total Posts

15 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
mustufam5967803
Level 1

Likes

2 likes

Total Posts

15 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
mustufam5967803
Level 1

05-02-2019

Thank you, try67

My question is for Adobe Campaign, could you please forward it to campaign experts for speedy answer.

Avatar

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile
try67
Level 2

05-02-2019

You posted your question in the Acrobat JavaScript forum. I moved it for you to the Adobe Campaign Classic forum.