Save count from query in workflow

Avatar

Avatar
Validate 1
Level 1
Chris_Thomas_So
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Chris_Thomas_So
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
Chris_Thomas_So
Level 1

24-08-2017

Hi,

I am looking for an example of saving the record count in a Adobe Campaign query. I then want to save the count into a database table table. Can anyone point me in the direction of saving just the record count and not the actual records.

Thanks.

Regards

Chris

Accepted Solutions (1)

Accepted Solutions (1)

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

01-09-2017

Hi Chris,

Were you able to have a look at Jean-Serge's suggestions?

Let us know,

Florent

Answers (2)

Answers (2)

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

24-08-2017

Hi Chris,

In a workflow, after the Query activity, an event variable vars.recCount is set with the result set count.
So you can use it in a Javascript activity to save the value in a dedicated table (report/historical table, for instance; or in xtk:options counter with JS method setOptions).

Or you can change the dimension with Change dimension activity, to use the insert / update integrated, with the value of recCount.


With the Javascript way, you have many choices to do so; please see the JSAPI documentation these availables methods:

1. Direct SQL instructions (update, insert) into your dedicated report tables:

sqlExec

execute
2. Using rather the Entity schemas (cleaner, but a bit less obvious):

set the entity properties then

xtk.session.Write

(or method save of the entity)

If your count doesn"t come from a Query activity but directly from a queryDef query written in your Javascript query, vars.recCount is not available so you must count with your result collection with length function.
resXXX.YYY.length()

Same system is valuable if you need to count several objects, in that case it is not vars.recCount or legnth that it is needed,  but a queryDef with count (group by) clauses; and then you put the count values in the dedicated report tables the same way, by using sqlExec or session.Write or save entity, based on the loop on the several count values.

By the way, you have created another ticket with same subject today as well, please keep only this one, close the other. Many thanks in advance for other readers.

Regards.
J-Serge

Avatar

Avatar
Validate 1
Level 1
Chris_Thomas_So
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Chris_Thomas_So
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
Chris_Thomas_So
Level 1

04-09-2017

Thank you for the response. Much appreciated. And apologies for the slow response.

Regards

Chris