function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DogmaDogma 

scripting toolkit

Hi
 
I'm using the scripting toolkit and I'm finding that it only exports 2000 records. How do I increase it so that it exports the whole table? And is it a good idea to export 900K records with it?
 
Cheers
 
function Results(queryResult) {
 if (queryResult.size > 0) {
  var output = "";
  var records = queryResult.getArray("records");
  for (var i=0;i<records.length;i++) {
   var account = records[i];
   output += account.Id + "," + account.Name + "\r\n";
  }
  WScript.echo(output);
 }else WScript.echo("No records matched.");
 ToolKit.Quit();
}
var callback = {onSuccess : Results, onFailure : function(e){WScript.echo(e)}};
var queryResult = sforce.connection.query("Select Id,Name from Account", callback);
 
Ron HessRon Hess
query() only returns 2000 records normaly, you should be able to use queryMore(), it is intended to be called in a loop, you will normaly get 2000 records each time.

i've not tried this in the scripting toolkit, but if queryMore() is there it should work.
900K records will take a while, is this a one time, or part of a regular process?
sfdcfoxsfdcfox
Honestly, I wouldn't want to wait for the download of 900k objects into my browser. If you're planning on using this for some really huge reporting app, I would likely suggest that you limit yourself to the smallest data set possible. Flex is, like most other things that live in a browser, a scripting language.

Browsers may freeze or crash trying to load this much data into a single user experience. Should it load successfully, it's still scripted, which is up to five times slower than compiled native code, so they might be sitting around for a while waiting for it to load or call up portions of the data (admittedly, Flash is highly optimized, but it's still not native code). However, that will largely depend on the size of the user's cache, virtual memory, and physical memory.

Running smaller queries (ie. providing date filters and providing date navigation/range options) will give better performance on the Salesforce server, better performance on the client's computer, and be more responsive to user interaction. Plus, if the user doesn't need 900k records downloaded to see what they want to see, they'll have saved lots of bandwidth and processing power.

~ sfdcfox ~
DogmaDogma
Thanx for the quick reply
 
Yes, this will be a one off. I'm trying to import the leads table into SQL server and it is bumming out on the double quotes " " in some of the colums. I want to be able to replace them with the | character so that it doesn't error on import.
 
Cheers