Page 1 of 1

Switch Calculation/ Pitstop Variable Set

Posted: Mon Aug 17, 2015 1:17 pm
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?

Re: Switch Calculation/ Pitstop Variable Set

Posted: Thu Aug 20, 2015 10:29 am
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.

Re: Switch Calculation/ Pitstop Variable Set

Posted: Tue Aug 25, 2015 9:56 am
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