Java "Includes" Not Working
Posted: Tue Oct 29, 2019 6:00 pm
What am I missing? I'm attempting to stash a piece of text in the JobState to be retrieved later by a configurator.
// 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 jobName = job.getNameProper();
job.log(1, jobName);
if (jobName.includes ("PORTFL")) {
job.setJobState("PORTFL");
}
if (jobName.includes ("PORTFD")) {
job.setJobState("PORTFD");
}
if (jobName.includes ("LANDFL")) {
job.setJobState("LANDFL");
}
if (jobName.includes ("LANDFD")) {
job.setJobState("LANDFD");
}
job.sendToSingle( job.getPath());
}
I get an error at whatever line number the second "if" is on, so presumably my first if statement is incorrect, though I don't get any syntax errors when saving the script
// 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 jobName = job.getNameProper();
job.log(1, jobName);
if (jobName.includes ("PORTFL")) {
job.setJobState("PORTFL");
}
if (jobName.includes ("PORTFD")) {
job.setJobState("PORTFD");
}
if (jobName.includes ("LANDFL")) {
job.setJobState("LANDFL");
}
if (jobName.includes ("LANDFD")) {
job.setJobState("LANDFD");
}
job.sendToSingle( job.getPath());
}
I get an error at whatever line number the second "if" is on, so presumably my first if statement is incorrect, though I don't get any syntax errors when saving the script