Expand my Community achievements bar.

SOLVED

Countdistinct is not working in query

Avatar

Level 4

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

1 Accepted Solution

Avatar

Correct answer by
Employee

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

View solution in original post

3 Replies

Avatar

Level 4

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>    );

Avatar

Level 10

Hi,

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

Florent

Avatar

Correct answer by
Employee

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