+ Start a Discussion
SalesRedSalesRed 

How To Extract Via Command Line Dataloader All Records Modifed in the Past Hour

Hi, I have a command line dataloader job which runs at half past each hour. I need to change it that it only extracts records modifed in the past 1 hour.  I can follow the instructions as per http://stackoverflow.com/questions/13129691/soql-query-that-extracts-data-that-got-updated-in-the-last-x-hours however there is one potential issue with this. When the day changes over at midnight querying for 
LastModifiedDate = TODAY AND HOUR_IN_DAY(LastModifiedDate) > 9 will not be correct.  Is there a way to get around this potential issue in the SOWL query?

Thanks for your help.
 
James LoghryJames Loghry
Your query needs to use a relative timestamp, which you populate based in a script that runs your DataLoader CLI command.   The script should populate and format the date to be SOQL compliant, as shown below:
 
Select Id,Lastmodifieddate from Account where LastModifiedDate >= 2015-12-01T01:00:00Z

Also, my locale may be different than your user's locale, so make sure your date format is correct (my locale is set to use the format YYYY-MM-DDTHH:MM:ssZ)
 
SalesRedSalesRed
Hi James,  Thank you.  Can you give an example of how I can populate the SOQL query into the process-conf file or ensute it's picked up at the time of execution?  What's the best approach for doing this.  My process.bat file I guess needs to pass this at the point of execution.

Thank you for any further help on this.