Entry points > Module Supervisor > Standard script AIMP3 

PRINT

The entry point PRINT is called just before the choice of printer. The only choice that is possible to make is to set the GPE variable that, if it is not equal to 0, inhibits the entry of a printer.

Context and operating mode

The following tables are on line :

Table

Significant content

Table description

AREPORT [ARP]

Yes

Report dictionary

The parameters are stored in the PARAMETRE variable with the indices 1 to NBPAR. Each value is a string in the form of "parameter=value" without any other separator. The report parameters are divided into 4 classes:

Those that start with a double underscore. These are the parameters destined for X3, they are not transmitted to the report .

Those that start with a single underscore. These are the parameters destined for Crystal Reports, they are not transmitted to the report. The values of these parameters are necessarily prefixed by chr$(1).

Those that start with X3. These are the context parameters transmitted to the report and automatically initialised by the supervisor.

Those that are described in the report dictionary. When the dictionary contains a parameter ending with "deb" or "str" another parameter with the same route ending with "fin" or "end" is automatically added.

The print server name is not a parameter. It is defined in the local variable SERVER(char(30)).


Parameter list:

__REPORT                          Crystal reports report name

__DESTINATION                 0=preview, 1=print, 2=e-mail, 3=file

__TYPDBA                           Database type (menu local 23)

__DBSERVER                    ODBC name

__DBDATABASE                     Database name

__DBUSER                          DB user

__DBPASSWORD             Password

__WSTATION    (*140)              Print server port number

__CDUSER         (*140)            User code

__APPLICATION                 Folder; machine; service (from where the print is launched)

__APPRPT                          Folder; machine; service (from where the report is found)

__REQUETE                       Request number

 

_PreVisuOptions                 Preview options (non operational)

_PrinterName                       Print name

_Orientation                          0=portrait, 1=landscape

_PrinterDriver (*)                  Printer driver name

_PrinterPort (*)                     Printer port

_PrinterDescription (*)        Printer characteristics

_FormatExport                     Export file format (menu local 91)

_FormatDelString                String deliminator if CSV format

_FormatDelRecord              Field separator if CSV format

_ExportFile                           Name of the exported file

 

X3DOS                                 Folder ;machine ;service;version;language (*140 version + language)

X3CLI                                    Customer name

X3EDT                                  Copyright

X3ETA                                  Report code

X3TIT                                    Report name

X3USR          (*130)             User code

X3LAN         (*140)                Report language directory

X3FCY       (*Géode)            Site

X3FCY       (*Géode)            Depositor

X3OPE                                 User name

X3SIT1          (*120)             Authorised sites

X3SIT1          (*120)             Prohibited sites

X3PRF          (*130)             Function profile

X3FCT           (*130)             Function associated with the report

X3SIT            (*130)             List of prohibited sites

(*) These parameters are dependent on the printer and cannot be described. They are normally recovered by the selimp instruction (make an attempt on a given printer and note the values of these parameters).

(*120) Available in V110 and V120, but not longer available in later versions.

(*130) Available starting from V130

 

Open tables

Only the AREPORT table containing the report in the process of being printed is significant.

 

Example of usage

 

####################################################################

##Example of the use of the entry points in AIMP3 processing

####################################################################

$ACTION

ACTION example

When "PRINT" : Gosub PRINT

When "PARAM" : Gosub PARAM

Endcase

Return

$IMPRIME

If [F:ARP]RPTCOD="REPORT1", "REPORT2","REPORT3") :                            : # List of reports to be processed

GPE = 1: #Avoids the entry of a printer

Endif

Return

$PARAM

####################################################################

## The parameters are contained in the PARAMETRE(1..NBPAR) variable)

## but the sub-programmes GETPARAM and SETPARAM of Trt REPORT

## makes it easier to access them

####################################################################

Local Char XPARAM(250)(1..10) , XPAR(50) , XVAL(50) , XETAT(20)

Local Integer XNB , XK , XI

####################################################################

## Has the print been requested on the printer?

####################################################################

Call GETPARAM("__DESTINATION",NBPAR,PARAMETER,XVAL) From ETAT

If XVAL<>"1"

Return : # No, then nothing is done

Endif

####################################################################

## Determining the printer as a function of the report

####################################################################

Call GETPARAM("X3ETA",NBPAR,PARAMETER,XETAT) From ETAT

Case XETAT

When "REPORT1" : XIMP = "my_printer"

When "REPORT2" : XIMP = "laser_printer"

When "REPORT3" : XIMP = "dot-matrix_line_printer"

When Default : Return

Endcase

####################################################################

## Allocation of the print server

####################################################################

SERVER = "the_machine_that_prints"

####################################################################

## Recovery of the default parameters for the printer

####################################################################

XNB = 0

XNB += 1 : XPARAM(XNB) = "_PrinterName=" + chr$(1) + XIMP : # Name of printer to be allocated

XNB += 1 : XPARAM(XNB) = "_Orientation=" + chr$(1) + "1" : #Landscape mode

XNB += 1 : XPARAM(XNB) = "_NoVisible=" + chr$(1) + "1" : # No entry

Selimp XPARAM = "" With XPARAM(1..XNB) : #Reading of default parameters

XNB = stat1

For XI=1 To XNB

XK = instr(1,XPARAM(XI),"=")

If XK

XPAR = left$(XPARAM(XI),XK-1)

XVAL = right$(XPARAM(XI),XK+1)

# If the default parameters are not wanted

# it is also possible to reassign them here

# If XPAR="_PrinterPort" : XVAL = "my_port" : Endif

Case XPAR

When "_PrinterName" , "_PrinterDriver" , "_PrinterPort"

& , "_PrinterDescription" , "_Orientation"

Call SETPARAM(XPAR,NBPAR,PARAMETER,XVAL) From ETAT

Endcase

Endif

Next XI

Return

PARAM

The entry point PARAM is used to modify any parameter in the report.

Context and operating mode

The following tables are on line :

Table

Significant content

Table description

AREPORT [ARP]

Yes

Report dictionary

REPORT

The entry point REPORT is used to start a process after the report has been printed. This entry point is executed just after the print order sent to the client (or the server). In the case of a print/file, it can be used to start a process on the generated file...

Context and operating mode

The following tables are on line :

Table

Significant content

Table description

AREPORT [ARP]

Yes

Report dictionary