Products Downloads


French version


 

 

      

      

      

WADELIA

      

 

 

 

(I/B) (C/S)

 

 

Important:

    • "CLOSE ViewName" can only be used in a server part.
    • "CLOSE LayoutCode" can only be used in a client part of an Adelia Web batch with report program.


Section for use

All

 

Syntax

CLOSE ViewName

CLOSE LayoutCode Format File

CLOSE LayoutCode Format Download

CLOSE LayoutCode Print

 

Format

*FORMAT(FormatName) | None

FormatName

'PDF' | 'RTF' | 'DOC' | 'XLS' | 'XML' | 'HTML' | AlphaVarId

     

File

*FILE(FileName) | None

FileName

'AlphaConstant' | AlphaVarId

     

Download

*DOWNLOAD | *DOWNLOAD(DocName) | None

DocName

'AlphaConstant' | AlphaVarId

     

Print

*PRINT PrintSettings | *PRINT(PrinterName) PrintSettings | None

PrinterName

PrinterNum | PrinterName

PrinterNum

1 | 2 | 3 | 4 | 5  | 6 | 7 | 8 | 9 | NumVarId

PrinterName

AlphaCnst | AlphaVarId

PrintSettings

Orientation PaperSource PaperSize Copies Duplex FromPage ToPage | None

Orientation

*ORIENTATION(OrAttr) | None

OrAttr

1 | 2 | NumVarId

PaperSource

*PAPER_SOURCE(AttrNum) | None

PaperSize

*PAPER_SIZE(NumAttr) | None

Copies

*NB_COPIES(CopiesAttr) | None

AttrCopies

AttrNum | NumAttr, Collated

Collated

*TRUE | *FALSE

Duplex

*DUPLEX(DuplexAttr) | None

AttrDuplex

1 | 2 | 3 | NumVarId

FromPage

*FROM_PAGE(NumAttr) | None

FromPage

*FROM_PAGE(NumAttr) | None

AttrNum

CstNum | NumVarId | None

 

 

 

 

Description

This instruction is used to manage the closing of files or layouts in a program.

 

The file can no longer be used in this program if it is not re-opened explicitly using the OPEN instruction. You can only close a file that has been opened, either implicitly or using the OPEN instruction.

 

By default, the opening and closing of files is managed implicitly by Adelia.

 

When you have to manage the opening or closing of files and layouts yourself, you must modify the default generation options and specify that you are managing the opening, or specify the *OPEN parameter for a declaration using the VIEW instruction.

 

Consequently, the program will not automatically open/close the file at the start and end of run; you will be able to handle these operations upon request.

 

If opening/closing a layout file, a layout file parameter must also be updated in the generation options.

 

These instructions can also be used without modifying the generation options. Obviously, in this case you must "CLOSE ViewName" before you "OPEN ViewName".

 

If the generation options have been changed to request the opening of a file, you can open this file using AS/400 commands (OPNDBF, etc.).

 

Example

* Immediate closing of the PARAM file if it is not subsequently needed.

/* Note: The "Open" parameter is left blank in the generation options

PARAM_KEY = 'TAX'

CHAIN PARAMETERS

W_TAX_RATE = PARAM_TAX_RATE

CLOSE PARAMETERS

*

 

Explicitly closing a layout file using the options included enables you to modify the standard behavior. An implicit close can display a report in PDF format in the Web browser. The "CLOSE LayoutCode" explicit close without any additional options serves the same purpose.

 

The CLOSE instruction - when related to a report layout - ends the running of the program except with the *FILE or the *PRINT, or if an error occurs processing the instruction. If an error occurs, the *RETURN_CODE reserved word can take the following values:

  • Value between 1 and 9999: error occurred during the report creation process.
  • Value between 10001 and 19999: middleware error (deduct 10000 from this value to find the "classical" middleware errors).
  • Value between 20001 and 29999: error occurred during the creation process of the HTTP response used to send the report to the web browser.

 

"*FORMAT(FormatName)" is used to modify the report's format. This format can be one of the following:

- WORD document if FormatName equals the 'DOC' constant

- EXCEL document if FormatName equals the 'XLS' constant

- Rich Text Format document if FormatName equals the 'RTF' constant

- XML document if FormatName equals the 'XML' constant

- HTML document if FormatName equals the 'HTML' constant

- PDF document if FormatName equals the 'PDF' constant

 

Note:

- if a document's format is not recognized, displaying it in the Web browser may not be possible. In this case, the browser opens a standard download dialog box used to save the document on the machine, or to select an application available on the machine to open the document.

- from Adelia Studio version 13.0 PTF05 onwards: the data is cached for 30 minutes (by default). This allows to resume an interrupted download process or to  launch several download requests. This wait time is configurable by changing the timeToIdleSeconds and timeToLiveSeconds parameters in the ehcacheAdelWeb.xml file (WEB-INF\classes directory) of your Web application. It is strongly recommended that you do not change the other parameters of this file.

 

"*FILE(FileName)" is used to store the report on the Web server. Here, the report is not sent to the browser to be displayed in it.

FileName can be a straightforward filename, or a name preceded by an absolute or relative path. With a straightforward filename or relative path, the basic storage directory is that of the current web application.

 

Using *DOWNLOAD or *DOWNLOAD(DocName) tells the web browser to open the standard download dialog box. This dialog box prompts you to save the document on the machine, or select an application available on the machine to open the document. By default, the document's name is "DocName" or 'Document'. The document's name is always suffixed by the extension specific to its format.

 

Note: The 'HTML' format is always displayed in the Web browser.

 

The use of "*PRINT" is reserved for an intranet context. Its purpose is to physically print the report.

Using "*PRINT" with no options is the same as using "*PRINT(1)".

PrinterNum defines a logical printer number. The association with a physical printer is stored in a configuration file. Print parameters not set using PrintSettings are read in this same configuration file.

PrinterName is the name of a printer resource.

 

*ORIENTATION is used to choose between portrait mode (1) or landscape mode (2).

 

*PAPER_SOURCE is used to choose the paper feed tray.

See the VaToolBx function VaToolBxSetAdeliaPrinterEx for the list of values.

 

*PAPER_SIZE is used to choose the paper size.

See the VaToolBx function VaToolBxSetAdeliaPrinterEx for the list of values.

 

*NB_COPIES is used to choose the number of copies to print (CopiesAttr). The additional "Collated" parameter can be used to group the copies, if necessary.

*DUPLEX is used to choose a single-side printout (1), duplex printout relative to the sheet's long side (2) or duplex printout relative to the sheet's short side (3).

*FROM_PAGE is used to define the first page to print.

*TO_PAGE is used to define the last page to print.

 

Note: only one report can be sent to the Web browser. This report is either the current report for an implicit close, or the report referenced by the first CLOSE instruction processed with no *FILE option.

 

Example

  • Send the report to the Web browser in Word format

CLOSE ReportCR1 *FORMAT('DOC')

  • Store the report on the web server in Excel format

CLOSE ReportCR1 *FORMAT('XLS') *FILE ('DirXLS\Report.xls')

  • Download the report in PDF format

CLOSE ReportCR1 *DOWNLOAD

  • Print the report using logical printer no. 1, forcing the orientation to landscape mode

CLOSE ReportCR1 *PRINT *ORIENTATION(2)

  • Print 3 grouped copies of the report on printer '\\SRVIMPR\IBMETG'

CLOSE ReportCR1 *PRINT('\\SRVIMPR\IBMETG') *NB_COPIES(3, *TRUE)

  • Print the report in duplex on logical printer no. 3

CLOSE ReportCR1 *PRINT(3) *DUPLEX(2)

 

See also the list of 4GL instructions by topic

↑ Top of page

  • Aucune étiquette