ELP can count any information inside and also outside a data stream. This page explains:

 

Other examples and the full description can be found

 

Counter, basics

ELP is able to increase, decrease, multiply and divide the integer value of any variable. The full syntax is depending upon the calculations:

  • Counter=VariableName[;Integer value to change].
  • Counter=VariableName[;#ELP_Variable#].
  • Counter=VariableName[;[+Integer][*Integer][-Integer][/Integer][%Integer][...]].
  • Counter=VariableName[;[-#ELP_Variable#][...]].

By default the change step is adding 1 to the value. For example, if you need to count a special word in the data stream:

[Search for the word Confidential and increase the counter]

Search_Binary=Confidential

Counter=#MyCounter#

If the correct page counter needs to be known in advance, and for example on every page the terms and conditions are inserted, multiply the Variable #PREPARSEPAGECOUNT# by to like that:

[GLOBAL]

....

; The Preparsing function evaluates the correct sum of pages.

Preparsing=ON

SetTrigger=1:ON

[Get final page number]

Trigger_Binary=1

; Primary Trigger above always true, so this rule is always executed.

; multiply the input pages by 2 and subtract 1, so this is the last page with data

Counter=#PREPARSEPAGECOUNT#;*2-1

; As Form F1001 (T&C) is inserted on every back page, but the last page = paper sheet is printed out of another tray

ELP_Command=C1:RI1S1F1000FFF1001;C1:#PREPARSEPAGECOUNT#I9;

Please note, that the last position to change counters is with the trigger command. Meaning that variables defined during the ELP out writing will not be changed anymore, like #VAL_ORIENTATION# etc.

Another example is to also print the T&C's on the back, but on the front page has to go a color watermark underneath the printed document.

[GLOBAL]

Preparsing=ON

SetTrigger=1:ON

[Do always the Form Command]

Trigger_Binary=1

; Primary Trigger above always true, so this rule is always executed.

; multiply the input pages by 2 and add 1, so this is the real printed last page plus 1

Counter=#PREPARSEPAGECOUNT#;*2+1

; As Form F1001 (T&C) is inserted on every back page, but as the G command is automatically inserted after a form feed,

, the X on the right handed page prevents the insertion for the last printed page (2 * incoming amount of pages) plus 1

ELP_Command=C1:RX#PREPARSEPAGECOUNT#I1S1F1000FF;C1:LF1001;

See also here for more complex example with more copies

 

Another example is to print the last page in simplex, when the duplexed job has got an odd amount of pages.

[GLOBAL]

....

; The Preparsing function evaluates the correct sum of pages.

Preparsing=ON

SetTrigger=1:ON

[If Job has only one page]

; primary trigger always true

Trigger_Binary=1

; secondary trigger true if only one page

Trigger_Variable=#PREPARSEPAGECOUNT#:1

; Set duplex to off

ELP_Command=C1:1S0;

; end here
Exit=ON;

[Then more than one page printed]

Trigger_Binary=1

; save the amount of pages in Variable #EvenOddPages#

Variable=#EvenOddPages#:#PREPARSEPAGECOUNT#

; and turn duplex printing on

ELP_Command=C1:1S1;

[Calculate if Even or Odd amount of pages]

Trigger_Binary=1

; Page num % 2 = 1 on Odd, = 0 on even amount pages

Counter=#EvenOddPages#;%2

[Print the last page if needed in simplex]

Trigger_Binary=1

; yes last page is on a right handed page

Trigger_Variable=#EvenOddPages#:1

; add the simplex exception for the last page to ELP Command

ELP_Command_ADD=C1:#PREPARSEPAGECOUNT#S0;


Find here more Counter examples


How to transfer counter values between jobs

ELP can continuously count events, like all print jobs, or jobs going to a certain printer, or any other counter on searched events, like amount of printed checks. See also Variables in ELP if your needed event is not already implemented and a variable for it does already exist.

Here is an example for a job counter, which has the small disadvantage that ELP serves several queues. It can happen that two jobs running the same time might have the same job number, as the number itself is read at the beginning but stored back at the end of the process. A started job in between may then read the same value. Therefore look at the key JOB_Counter to implement this function correctly.

[GLOBAL]

; read the variable file at the job beginning

; There is only on variable in: #MyCount#

Variable_File=c:\ProgramData\WELP\JobCounter.txt

; Then increase the variable automatically

Counter=#MyCount#

; And store it back at the job end to the same file

Variables_Store=c:\ProgramData\WELP\JobCounter.txt;#MyCount#

Those counters can be used in the printed documents for generating for example bar codes on the fly: For the example above open an MS Word document, and insert a field: PRINT 14 27 ")10U" 27 ")s1p12vsb4148T#MyCounter#" 15 or use the forms_field_installer.doc macro.

Then the job number is printed in Univers at the given position. You may change the font definition any time for example to a definition of a bar code from the bar code section.

ELP is also able to use as many as needed counters, for example for all controlled queues, even with queue unique variables, like below #MC9500#;#MC4650#, or for events like check numbers etc.

[GLOBAL]

Variable_File=c:\ProgramData\WELP\JCount.txt

Variables_store=c:\ProgramData\WELP\JCount.txt;#MC9500#;#RI420#;

[HP Color LaserJet 9500]

Counter=#MC9500#

[Ricoh Aficio 420]

Counter=#RI420#

In that example every queue has an own variable, but you may have it even easier using a job counter, following next.

Find here more Counter examples


Job Counter

You may use the rule assistant in order to generate a job counter. The form 23010 prints the job counter as a bar code with readable text below on the left hand of the page, rotated by 90°. You may use the Forms & Field Installer to generate such forms.

The following steps generate an automatic job counter, which can be placed at any position on the page, or simply be used to count jobs.

  1. A job counter can be placed in every activated rule. So in theory ELP can handle nearly indefinite rules with the same amount of counters. But be careful, as by default always the same variable #JOB_COUNTER# is used, the variable content is the counter of the last read counter file.
  2. The variable key JOBCOUNTER points to any regular text file. The file holds in the first line the start up value of the counter, which is incremented and stored right away back to the file. The increased value is then available in the ELP variable #JOB_COUNTER#.
  3. The variable itself can be used like explained on the last page in forms or using Search and Add or Insert.
  4. If you like to use different variable names then simply add your name to the command semicolon separated. For example:

    JobCounter=#ELP_FORMS_PATH#InvoiceCounter.var;#MyInvCount#

To install an overall job counter simply add the variable key JOB_COUNTER into the section global, leave the default argument as it is. As long as the variable #JOB_COUNTER# is not used in a form, open the file after some jobs and look at the value.

Another example is to establish a counter how many documents / jobs are printed, which contains the word confidential:

[Search for Confidential]

Search_Windows=Confidential
JobCounter=#ELP_FORMS_PATH#confidential.var

; print it on the first page

ELP_Command=C1:1F23010;

Tip: The variable can of course be exported into any report / accounting file or can be passed to any external software by command line parameter using one of the CALL keys.

You may also use any time after that the variable #JOB_COUNTER# in any form or data stream.

Note Please keep in mind, that as soon as the variable #JOB_COUNTER# is defined, ELP will NOT read the JOBCOUNTER key anymore.

[Global]

JobCounter=#ELP_FORMS_PATH#JobCounter.var;#MyTotalJobCounter#

[Invoice]

Trigger_Binary=Invoice
JobCounter=#ELP_FORMS_PATH#InvoiceCounter.var

This way will work out, as the variable #JOB_COUNTER# is defined in the rule invoice. If the two counter lines are flipped, the Invoice rule JobCounter key is ignored as the variable #JOB_COUNTER# was already defined by the command in GLOBAL.

 

Related articles: Bar code with the user name and a continuous counter, Variables in ELP, [Job]Counter examples