Switch Calculation/ Pitstop Variable Set

Post Reply
Chrissigge
Newbie
Posts: 19
Joined: Mon Jun 01, 2015 8:05 am
Location: Switzerland

Switch Calculation/ Pitstop Variable Set

Post by Chrissigge »

Hello, I hope the title is not too confusing.

Heres my problem:

with Pitstop im creating an rectangular shape and place it on my incoming PDF File,
the shape length should be calculated based on 2 values from the XML-File.
These values have a unknown length. Im saving the length values into hierarchy path.

I can read out each value:
First value
[Switch.Calculation:Expression="[Job.Hierarchy:Index="1"]+10.0"]
or second value
[Switch.Calculation:Expression="[Job.Hierarchy:Index="2"]+10.0"]

In order to create the rectangular shape in the correct size I need to know which of these values the longest one is.
An if else rule would be an easy option but i don't see the possibility to use this with variable sets....

Does anyone have an idea?
bens
Member
Posts: 130
Joined: Thu Mar 03, 2011 10:13 am

Re: Switch Calculation/ Pitstop Variable Set

Post by bens »

Do you have the Switch scripting module? If so, this becomes quite easy: the variable to be used in PitStop would be of type "Script expression", and the code something like this (untested):

var value1 = job.getVariableAsNumber( "[Switch.Calculation:Expression=\"[Job.Hierarchy:Index=\"1\"]+10.0\"]" );
var value2 = job.getVariableAsNumber( "[Switch.Calculation:Expression=\"[Job.Hierarchy:Index=\"2\"]+10.0\"]" );
(value1 > value2) ? value1 : value2;

The result of this script expression is the largest value.
loicaigon
Member
Posts: 147
Joined: Wed Jul 10, 2013 10:22 am

Re: Switch Calculation/ Pitstop Variable Set

Post by loicaigon »

Hi,

You can achieve the same result without the scripting module. A simple condition with variables applied to a connection will work.

You can create two outgoing connections. You will then set one outgoing connection with a connection with variable. As a parameter just enter this line ion first field :

[Switch.Calculation:Expression="[Job.Hierarchy:Index="1"]"]

and this one in second field :

[Switch.Calculation:Expression="[Job.Hierarchy:Index="2"]"]

For the operator choose greater (…or equals).

Then on the second connection choose all other jobs. Then you can do further processing.

HTH,

Loic
http://www.ozalto.com
Post Reply