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
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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.
Schema Data:
Views
Replies
Total Likes
There is a second queryDef in this code which you have completely skipped
Without this, your while loop code will run into an infinite loop.
Regards,
Vipul
Views
Replies
Total Likes