Save the MAX eventDate of nms:broadLogRcp

Avatar

Avatar
Validate 25
Level 4
salvdangelo
Level 4

Likes

45 likes

Total Posts

130 posts

Correct reply

4 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 4
salvdangelo
Level 4

Likes

45 likes

Total Posts

130 posts

Correct reply

4 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
salvdangelo
Level 4

19-12-2017

Hi,
I'm trying to get the MAX value of @eventDate from Recipient delivery logs (nms:broadLogRcp)
I tried this option but vars.maxBroadLogEvent output is always empty.

var query = xtk.queryDef.create( 

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

    <select> 

      <node expr="@eventDate"/> 

    </select>

    <orderBy>

     <node expr="@eventDate" sortDesc="true"/>

    </orderBy>

  </queryDef> 

); 

result = query.ExecuteQuery(); 

vars.maxBroadLogEvent = result[0].@eventDate;

logInfo("MAX BROADLOG EVENT: "+ vars.maxBroadLogEvent);

 

for each (var e in result) { 

 

logInfo(e.@eventDate); 

 

}

Can you identify the issue?

Jean-Serge Biron
@nkur
Adhiyan
kirti.rawat
Adobe Campaign

Replies

Avatar

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Jean-Serge_Biro
MVP

19-12-2017

Hi Salvatore,

Your code works perfectly on my instance.

Please check if your delivery mapping is using nms:broadlogrcp, perhaps are you using a specific one?

Please use the Generic query editor tool to have a look on the broadlogrcp content, and especially the eventDate column, to be sure that it is the workflow behavior that is wrong.

Then add another column  in your loop to debug or for [0] record to be sure as well.

Regards

JS

Avatar

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Jean-Serge_Biro
MVP

19-12-2017

PS: if you intend to use Message Center messages, the delivery mapping is nms:broadlogRcpEventHisto

Avatar

Avatar
Give Back 50
Level 10
florentlb
Level 10

Likes

237 likes

Total Posts

1,109 posts

Correct reply

239 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 200
View profile

Avatar
Give Back 50
Level 10
florentlb
Level 10

Likes

237 likes

Total Posts

1,109 posts

Correct reply

239 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 200
View profile
florentlb
Level 10

02-01-2018

Hi,

Were you able to figure out why you got this issue?

Let us know,

Florent

Avatar

Avatar
Springboard
Level 6
David__Garcia
Level 6

Likes

106 likes

Total Posts

192 posts

Correct reply

44 solutions
Top badges earned
Springboard
Establish
Validate 10
Coach
Contributor
View profile

Avatar
Springboard
Level 6
David__Garcia
Level 6

Likes

106 likes

Total Posts

192 posts

Correct reply

44 solutions
Top badges earned
Springboard
Establish
Validate 10
Coach
Contributor
View profile
David__Garcia
Level 6

02-01-2018

The following is another way of querying the max value for whatever column

maxId = sqlSelect("Records,@id:string","SELECT MAX(ideliveryId) FROM Neolane.Neolane.NmsrtEvent");

logInfo(maxId.Records.@id);

In your case, something like the following;

maxEventDate = sqlSelect("Event,@maxDate:string","SELECT MAX(tsEvent) FROM Neolane.Neolane.NmsbroadLogRcp");//replace neolane with your database name.schema

logInfo(maxEventDate.Event.@maxDate);

Depending on the amount of records in this table, it could take a while for the query to run. my db has more than 40m records in here.

Avatar

Avatar
Contributor
Level 3
saikatk2447661
Level 3

Likes

22 likes

Total Posts

58 posts

Correct reply

14 solutions
Top badges earned
Contributor
Shape 1
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Contributor
Level 3
saikatk2447661
Level 3

Likes

22 likes

Total Posts

58 posts

Correct reply

14 solutions
Top badges earned
Contributor
Shape 1
Give Back 5
Give Back 3
Give Back
View profile
saikatk2447661
Level 3

07-01-2018

Hi Salvdangelo,

If there is any delivery log with status ignored, there will be no eventdate but it will come on top of the list. To mitigate this issue use the following syntax.

<select>

      <node expr="@eventDate"/>

    </select>

   <where>

      <condition expr="@eventDate is not null"/>

    </where>

    <orderBy>

     <node expr="@eventDate" sortDesc="true"/>

    </orderBy>

Thanks

Saikat