Page 1 of 1

Script Element not moving files through

Posted: Wed Jan 18, 2012 3:59 pm
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 )

{

}

Script Element not moving files through

Posted: Thu Jan 19, 2012 3:19 pm
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