7.67.52015-05-06

Print a variable number of copies of a page based on a value in the datastream

This sample prints a variable number of copies of a page based on an integer value in the data stream. It uses a global integer variable &nbPage that is initialized to 0, and subsequently set to the value of the data that appears on line 1, columns 1 through 2 of the data page.

The document for which it was written uses two pages: DATA and RUNPAGE. DATA is an overlay page that contains all of the data selections for the document. RUNPAGE is a runpage and the code that appears here is in a PlanetPress Talk object on RUNPAGE.

% ====================================================
% PRINT A VARIABLE NUMBER OF COPIES OF A PAGE BASED ON
% A VALUE IN THE DATA STREAM
% ====================================================

if(ne(&printermode,0))
 set(&nbPage,strtoint(@(1,1,2)))
 define(&it,integer,0)
 for(&it,1,1,strtoint(@(1,1,2)))
  execpage('DATA')
  showpage()
 endfor()
endif()

Notes: