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
Routing Expression
Try making your Metadata path read "Metadata.Rational" (or Integer) not "Metadata.Text"
Routing Expression
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.
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.