Page 1 of 1

Routing Expression

Posted: Wed Nov 06, 2013 1:48 pm
by aoswood
I am trying to write a script expression to move PDFs to the correct Pitstop Preflight profile. It looks at the trim size of the PDF and compares it to a XML ticket.



I get an error when I try to run this, it won't convert my XML metadata to a number to compare.



Error in line 8 of script : TypeError. Undefined member function 'unknown' for object '3.5' of type: 'Number'



var jh = job.getVariableAsNumber('[Stats.TrimboxHeight]')

var jw = job.getVariableAsNumber('[Stats.TrimboxWidth]')

var th = job.getVariableAsNumber('[Metadata.Text:Path="/notification/order/orderItem/orderItemPrintJob/finishedHeight",Dataset="Xml",Model=XML]')

var tw = job.getVariableAsNumber('[Metadata.Text:Path="/notification/order/orderItem/orderItemPrintJob/finishedWidth",Dataset="Xml",Model=XML]')





((jh > jw && th > tw) || (jh tw))



Thanks

Andy

Routing Expression

Posted: Thu Nov 07, 2013 10:29 am
by froodster
Try making your Metadata path read "Metadata.Rational" (or Integer) not "Metadata.Text"

Routing Expression

Posted: Thu Nov 07, 2013 4:25 pm
by aoswood
I got it working and I figured out a couple of problems.



1. SWITCH did not like having parentheses in my expression.



This worked:

jh >= jw && th >= tw || jh <= jw && th <= tw



2. The logic I was using for the routing was incorrect for what I was trying to accomplish.