Script Element not moving files through

Post Reply
sgeller
Newbie
Posts: 7
Joined: Wed Jan 18, 2012 1:53 am

Script Element not moving files through

Post by sgeller »

I have a script element that seems to be running ok in testing, but the files are not being passed through.



This is my first scripting attempt. Is there something obvious i'm missing that says pass data along?



My entire code is below.

Thanks



// Is invoked each time a new job arrives in one of the input folders for the flow element.

// The newly arrived job is passed as the second parameter.

function jobArrived( s : Switch, job : Job )

{

var myFile = new File("C:/Users/macprep/Desktop/log.txt");

myFile.open( File.WriteOnly | File.Append );

myFile.writeLine( job.getVariableAsString("[Metadata.Text:Path="/Orders/Order/OrderNumber",Dataset="Xml",Model=XML]", s) );

myFile.close();

}



// Is invoked at regular intervals regardless of whether a new job arrived or not.

// The interval can be modified with s.setTimerInterval().

function timerFired( s : Switch )

{

}
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Script Element not moving files through

Post by dkelly »

Hi, you need to tell Switch which files to pass to next step.



If you just want to pass the input file unchanged to the output, add job.sendToSingle() to your function.





function jobArrived( s : Switch, job : Job )

{

var myFile = new File("C:/Users/macprep/Desktop/log.txt");

myFile.open( File.WriteOnly | File.Append );

myFile.writeLine( job.getVariableAsString("[Metadata.Text:Path="/Orders/Order/OrderNumber",Dataset="Xml",Model=XML]", s) );

myFile.close();



job.sendToSingle(job.getPath());

}





Dwight Kelly

Apago, Inc.

dkelly@apago.com
Post Reply