Get Different Email Domain Count in WorkFlow | Community
Skip to main content
New Participant
December 27, 2019
Solved

Get Different Email Domain Count in WorkFlow

  • December 27, 2019
  • 1 reply
  • 1705 views

I would like to query the Recipients table in Campaign and get an output with all the different email Domains ( of all recipients ) along with the count of these domains. 

My question is :

  1.  How can i achieve this in a Workflow 
  2.  How can i achieve this in the Javascript activity using sqlSelect / xtk:QueryDef operation 

Any help will be appreciated

 

thanks

a

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jonathon_wodnicki

Hi,

 

1: Use a query activity, with nms:recipient as targeting/filtering dimensions, @1716897>0 as where clause and select clause defined by Edit additional data:

  1. Add @2977804, check the 'Group by' box next to it
  2. Add a col, type in count(@id)
  3. Click 'Advanced parameters...' link, Check Disable automatic adding of primary key

 

2: Don't use sqlSelect unless there is a clear reason, e.g. complex queries that have perf requirements. In querydef:

var recipients = xtk.queryDef.create(
  <queryDef schema="nms:recipient" operation="select" distinct="true">
    <select>
      <node expr="@domain" groupBy="1"/>
      <node expr="count(@id)" alias="@count"/>
    </select>
  </queryDef>).ExecuteQuery();
for each (var recipient in recipients.recipient) {
  logInfo(recipient.@domain, recipient.@count);
}

 

Thanks,

-Jon

1 reply

Jonathon_wodnicki
Jonathon_wodnickiAccepted solution
New Participant
December 30, 2019

Hi,

 

1: Use a query activity, with nms:recipient as targeting/filtering dimensions, @1716897>0 as where clause and select clause defined by Edit additional data:

  1. Add @2977804, check the 'Group by' box next to it
  2. Add a col, type in count(@id)
  3. Click 'Advanced parameters...' link, Check Disable automatic adding of primary key

 

2: Don't use sqlSelect unless there is a clear reason, e.g. complex queries that have perf requirements. In querydef:

var recipients = xtk.queryDef.create(
  <queryDef schema="nms:recipient" operation="select" distinct="true">
    <select>
      <node expr="@domain" groupBy="1"/>
      <node expr="count(@id)" alias="@count"/>
    </select>
  </queryDef>).ExecuteQuery();
for each (var recipient in recipients.recipient) {
  logInfo(recipient.@domain, recipient.@count);
}

 

Thanks,

-Jon

akshay2Author
New Participant
December 31, 2019

Hi Jon

Sorry my question was not clear.  What i would like to do is to group the results based on emailDomain and show the count. Something like this 

 

gmail.com       32 

yahoo.com      5

reditt.com        6

 

Thanks

a