Countdistinct is not working in query | Community
Skip to main content
Level 4
February 20, 2018
Solved

Countdistinct is not working in query

  • February 20, 2018
  • 3 replies
  • 3229 views

Hi,

I have the following query

var clickQuery = xtk.queryDef.create(

      <queryDef schema={vars.targetSchema} operation="select" >

          <select >                                 

             

          <node expr="distinct(@journalDistributionID)" alias="@clicksJD_id"/>

           <node expr="date(@created)" alias="@clicksDate"/>

            <node expr="count(@type)" alias="@clicksCount"  /> 

            <node expr="count([@broadLog-id])" alias="@ID" />         

                                              

          </select>

            <where>

            <condition bool-operator="AND">

           <condition expr="@type='1'" />

           <condition expr="@type!='3'" />

           </condition>

            </where>

          <orderBy/>                  

          <groupBy>

        <node expr="@journalDistributionID" />

          <node expr="date(@created)" />

        

          <node expr="@type"   />

         

         

         

          </groupBy>          

      </queryDef>    );

Unfortunately Countdistinct is not working for me. Can you pls help?

Regards,

Priyanka

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 Adhiyan

Hi Priyanka,

 

CountDistinct as a function should work , probably the syntax for picking up broadLog-id is wrong.

If the target schema is linked to the broadLogRcp schema the syntax would be [targer/@broadlog-id] .

 

regards,

adhiyan

3 replies

Level 4
February 20, 2018

Sorry I'm reposting my query

var clickQuery = xtk.queryDef.create(

      <queryDef schema={vars.targetSchema} operation="select" >

          <select >                                 

             

          <node expr="distinct(@journalDistributionID)" alias="@clicksJD_id"/>

           <node expr="date(@created)" alias="@clicksDate"/>

            <node expr="count(@type)" alias="@clicksCount"  /> 

            <node expr="Countdistinct([@broadLog-id])" alias="@ID" />         

                                              

          </select>

            <where>

            <condition bool-operator="AND">

           <condition expr="@type='1'" />

           <condition expr="@type!='3'" />

           </condition>

            </where>

          <orderBy/>                  

          <groupBy>

        <node expr="@journalDistributionID" />

          <node expr="date(@created)" />

        

          <node expr="@type"   />

         

         

         

          </groupBy>          

      </queryDef>    );

florentlb
Level 10
March 13, 2018

Hi,

I don't know what can cause this. Were you able to resolve the issue since?

Florent

Adhiyan
Adobe Employee
AdhiyanAdobe EmployeeAccepted solution
Adobe Employee
December 16, 2019

Hi Priyanka,

 

CountDistinct as a function should work , probably the syntax for picking up broadLog-id is wrong.

If the target schema is linked to the broadLogRcp schema the syntax would be [targer/@broadlog-id] .

 

regards,

adhiyan