XML PICK UP RESULTING FLOW

abonsey
Member
Posts: 98
Joined: Fri May 24, 2013 5:10 pm

XML PICK UP RESULTING FLOW

Post by abonsey »

Thanks for that.

Any guidance on how to script it as I've never scripted before?
freddyp
Advanced member
Posts: 413
Joined: Thu Feb 09, 2012 3:53 pm

XML PICK UP RESULTING FLOW

Post 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
abonsey
Member
Posts: 98
Joined: Fri May 24, 2013 5:10 pm

XML PICK UP RESULTING FLOW

Post 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
freddyp
Advanced member
Posts: 413
Joined: Thu Feb 09, 2012 3:53 pm

XML PICK UP RESULTING FLOW

Post 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
Post Reply