Topic
  • 1 reply
  • Latest Post - ‏2013-04-01T17:56:43Z by KaranBal
KunalD
KunalD
10 Posts

Pinned topic How to run an Import Feed sequentially.

‏2013-03-28T13:17:15Z |
Hi,

We have a requirement for running an Import feed for multiple csv files sequentially. The csv files are stored in the docstore. We need to run the import feed for all the files available in the docstore.

the code snippet below is capable of importing the first file.

var files = getDocStoreSubtreeList("/"+ sDocStorePath);
if(files != null && files.size()>0)
{
for(var i = 0; i < files.size(); i++)
{
catchError(err)
{
var doc = getDocByPath(files[i]);
var sDocDate = doc.getDocLastModifiedTimeStamp();
if(sDocDate.formatDate(ddmmyyyy) == today().formatDate(ddmmyyyy))
{

startAggregationByName(sImportFeed,files[i]);

}
}
}
}
Updated on 2013-04-01T17:56:43Z at 2013-04-01T17:56:43Z by KaranBal
  • KaranBal
    KaranBal
    108 Posts

    Re: How to run an Import Feed sequentially.

    ‏2013-04-01T17:56:43Z  
    My suggestion would be to not use the code snippet you pasted and create an import job to import one feed file. Then you can run this job from the sandbox, wait for it to be complete, run the second one and so on. Here's an example:

    function RunReport(attr_JobName, attr_JobType){
    useTransaction
    {
    var scheduleID = runJob(attr_JobName,attr_JobType);
    }
    out.writeln(scheduleID);
    while(queryJobStatus(scheduleID) == "Not Started" || queryJobStatus(scheduleID) == "Running") {
    }
    out.writeln(attr_JobName + " complete with status of " + queryJobStatus(scheduleID));
    }
    function init(){
    out.writeln("The report job started successfully");
    RunReport("Report1","REPORTEXE");
    RunReport("Report2","REPORTEXE");
    RunReport("Report3","REPORTEXE");
    ...
    }
    init();