Page 2 of 2
XML PICK UP RESULTING FLOW
Posted: Fri Dec 12, 2014 2:14 pm
by abonsey
Thanks for that.
Any guidance on how to script it as I've never scripted before?
XML PICK UP RESULTING FLOW
Posted: Fri Dec 12, 2014 2:35 pm
by freddyp
The script expression would look like this:
var fileName = s.getVariableAsString("[Job.NameProper:After_]");
s.getVariableAsString("[Metadata.Text:Path="/Request/Items/Item[@LineNumber='+fileName+']/Quantity",Dataset="Xml",Model="XML"]");
Not tested! I hope I got all the single and the double quotation marks, and the escaping right
Freddy
XML PICK UP RESULTING FLOW
Posted: Mon Jan 05, 2015 5:45 pm
by abonsey
Having had a nice Xmas break I'm now looking at this again.
As I said before I'm new to the scripting and what I'm trying to do is only add files to a folder with a certain quantity ie =200.
How do I add this to the scripting expression?
Thanks for any help
XML PICK UP RESULTING FLOW
Posted: Tue Jan 06, 2015 10:50 am
by freddyp
So what you want is not the quantity, but whether the quantity is equal to 200 or not. In other words, you are using this as a condition on an outgoing connection. Conditions must be either true or false, so you have to make sure the script expression results in "true" or "false":
var fileName = s.getVariableAsString("[Job.NameProper:After_]");
var quantity = s.getVariableAsNumber("[Metadata.Integer:Path="/Request/Items/Item[@LineNumber='+fileName+']/Quantity",Dataset="Xml",Model="XML"]");
if (quantity == 200) {
true;
} else {
false;
}
Again, not tested.
Freddy