Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Countdistinct is not working in query

priyankah586599
Level 4
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
Adhiyan
Correct answer by
Employee
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
priyankah586599
Level 4
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>    );

florentlb
Level 10
Level 10

Hi,

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

Florent

Adhiyan
Correct answer by
Employee
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