Routing Expression

Post Reply
aoswood
Newbie
Posts: 18
Joined: Wed Sep 14, 2011 6:16 pm

Routing Expression

Post 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
froodster
Newbie
Posts: 8
Joined: Wed Jan 09, 2013 3:41 pm

Routing Expression

Post by froodster »

Try making your Metadata path read "Metadata.Rational" (or Integer) not "Metadata.Text"
aoswood
Newbie
Posts: 18
Joined: Wed Sep 14, 2011 6:16 pm

Routing Expression

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