You need to sign in to do that
Don't have an account?
BOFH
Extracting >2000 records
I am attempting to extract roughtly 4246 records from SalesForce. I know the limit on the batch size is only 2000, which is where my problem comes in. I get it to run through the loop 4246 times, but I end up with exactly 2246 null records. I am not sure what I am doing wrong. I have gone through the message board, but haven't been able to find much help, and staring at the code isn't working too well either. So if anyone has any suggestions, they would be appreciated. Below is the code I am using. Thanks.
binding.QueryOptionsValue.batchSize = 2000;
binding.QueryOptionsValue.batchSizeSpecified = true;
qr = binding.query("Select Id, OpportunityId, PricebookEntryId, Quantity, Option_id__c " +
" FROM OpportunityLineItem WHERE Option_id__c <= \'0\'");
done = false;
if (qr.size > 0)
{
initializeArrays(qr.size);
while (!done)
{
for (int i = 0; i < qr.records.Length; i++)
{
sObject rec = qr.records[i];
id[i] = getValue("Id", rec.Any);
opportunityId[i] = getValue("OpportunityId", rec.Any);
priceBookId[i] = getValue("PriceBookEntryId", rec.Any);
quantity[i] = getValue("Quantity", rec.Any);
optionId[i] = getValue("Option_id__c", rec.Any);
}
if (qr.done)
done = true;
else
qr = binding.queryMore(qr.queryLocator);
}
}
Let me know if you need any more information. Thanks again.
binding.QueryOptionsValue.batchSize = 2000;
binding.QueryOptionsValue.batchSizeSpecified = true;
qr = binding.query("Select Id, OpportunityId, PricebookEntryId, Quantity, Option_id__c " +
" FROM OpportunityLineItem WHERE Option_id__c <= \'0\'");
done = false;
if (qr.size > 0)
{
initializeArrays(qr.size);
while (!done)
{
for (int i = 0; i < qr.records.Length; i++)
{
sObject rec = qr.records[i];
id[i] = getValue("Id", rec.Any);
opportunityId[i] = getValue("OpportunityId", rec.Any);
priceBookId[i] = getValue("PriceBookEntryId", rec.Any);
quantity[i] = getValue("Quantity", rec.Any);
optionId[i] = getValue("Option_id__c", rec.Any);
}
if (qr.done)
done = true;
else
qr = binding.queryMore(qr.queryLocator);
}
}
Let me know if you need any more information. Thanks again.
Thanks.