Script HELP on outgoing connection
Posted: Wed Apr 19, 2023 4:38 pm
Hello,
I'm new to using the SwitchScripter and I'm trying to create a script that will allow the user to input to numbers and select a comparison of ">" or "<"
and send the result to the connection that has the outgoing connection property of "True" to one connection and "False" to the other connection based on the result - Again excuse my newness
I was trying to use the job.SendTo() but I don't think that is the way so I have it
Current Code:
Current setup in SwtichScripter.
I'm new to using the SwitchScripter and I'm trying to create a script that will allow the user to input to numbers and select a comparison of ">" or "<"
and send the result to the connection that has the outgoing connection property of "True" to one connection and "False" to the other connection based on the result - Again excuse my newness
I was trying to use the job.SendTo() but I don't think that is the way so I have it
Current Code:
Code: Select all
function jobArrived(s: Switch, job: Job) {
var privateData = s.getPropertyValue("EntryNumber");
var compareNumber = s.getPropertyValue("CompareNumber");
var comparison = s.getPropertyValue("Comparison");
var isTrue = false;
var isFalse = false;
if (comparison === "<") {
if (parseInt(privateData) < parseInt(compareNumber)) {
isTrue = true;
} else {
isFalse = true;
}
} else if (comparison === ">") {
if (parseInt(privateData) > parseInt(compareNumber)) {
isTrue = true;
} else {
isFalse = true;
}
} else if (comparison === "=") {
if (parseInt(privateData) === parseInt(compareNumber)) {
isTrue = true;
} else {
isFalse = true;
}
}
if (isTrue) {
job.sendTo(True);
} else if (isFalse) {
job.sendTo(False);
}
}