Fetching the records from schema based on size

jitendrat766521

03-08-2018

Hi Team,

I want to retrieve the records based on size from schema in adobe campaign...so how to implement this one in Adobe campaign.

For Example:

if schema having 100 records then i need to select 20 records only from 100 recors

And next time i need to  retrive from 20 to 40 records and next ineed to retrive the records from 40 to so...

So how to achieve this ...please help me on this..

Regards

Jitendra

Accepted Solutions (0)

Answers (3)

Answers (3)

Vapsy

Employee

07-08-2018

Hi jitendrat76652144,

There is a second queryDef in this code which you have completely skipped 1543516_pastedImage_1.png

Without this, your while loop code will run into an infinite loop.

Regards,
Vipul

jitendrat766521

06-08-2018

Hi Vipul,

Thank you for your response,I am not able to fetch the any records from schema by using below  code.Please help me on this if anything i am doing wrong.

1543062_pastedImage_0.png

Schema Data:

1542895_pastedImage_4.png

Vapsy

Employee

04-08-2018

Hi Jitendra,

You can try this code in a JS activity

var recordsToFetchPerBatch = 20; 

var currentStartLine = 0;

var query = xtk.queryDef.create(

  <queryDef schema="cus:mySchema" operation="select" lineCount={recordsToFetchPerBatch} startLine={currentStartLine}>

    <select>

      <node expr="@id"/>   

    </select>

  </queryDef>);

var result = query.ExecuteQuery();

try

{

while (result != "")

 

for each (var record in result)

{

currentStartLine++;

           

//do your stuff

     

} // end for

query = xtk.queryDef.create(

<queryDef schema="cus:mySchema" operation="select" lineCount={recordsToFetchPerBatch} startLine={currentStartLine}>

<select>

  <node expr="@id"/>   

</select>

  </queryDef>);

var result = query.ExecuteQuery();

} // end while

}

catch (e)

{

  logError("*** FAILED ***");

}

Regards,
Vipul