Expand my Community achievements bar.

SOLVED

Limit???

Avatar

Level 2

The  given code had limit of 10,000.?

var query = xtk.queryDef.create(

  <queryDef schema="xtk:workflow" operation="select">

  <select>

  <node expr="@internalName"/>

  </select>

  </queryDef>

)

var res = query.ExecuteQuery()

for each (var w in res.workflow)

{

  logInfo(w.@internalName)

}

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello,

I would not be surprised as in client you can see in "Generated SQL query.."  LIMIT 10000 at the end of the query. Have you tried the following:

Create queries in the loop and change the startLine attribute in every iteration until you process all records?

<queryDef schema="nms:recipient" operation="select" startLine="10000">

BR,

Marcel

View solution in original post

7 Replies

Avatar

Correct answer by
Community Advisor

Hello,

I would not be surprised as in client you can see in "Generated SQL query.."  LIMIT 10000 at the end of the query. Have you tried the following:

Create queries in the loop and change the startLine attribute in every iteration until you process all records?

<queryDef schema="nms:recipient" operation="select" startLine="10000">

BR,

Marcel

Avatar

Level 2

yes i already tried this , If we have a 10 Lakh  data then we have to write the script 100 times . So  it is not the practical answer .

Avatar

Community Advisor

Hello, You can do it in a loop and startLine number incrase automatically via variable and with every loop just check if you retrieved records.

Avatar

Level 2

Great Actually today i just got this answer in my mind and thanks for your help

Avatar

Level 1

Hello, could you guys please share the solution?

Avatar

Community Advisor

Hello Juan,

Just need to connect the comments. But following might be a good start

var startLine = 0;

var limit = 9999;

var loop = true;

while(loop){

     var query = xtk.queryDef.create(

           <queryDef schema="xtk:workflow" operation="select" startLine={startLine} limit={limit}>

                <select>

                     <node expr="@internalName"/>

                      ..

                </select>

           </queryDef

     );

     result = query.executeQuery();

     if(Object.keys(result).length>0){

          //do stuff

          //

          startLine = startLine + limit + 1;

     }else

          loop = false;

    

}

Hope this helps,

Marcel

Avatar

Level 4

As per the query def schema, noLineCount="true" should work.

<attribute label="Do not limit the number of lines returned by the query" name="noLineCount"

               type="boolean"/>

But it seems not working.

Any idea why? PabloRosero