PRINT operator
The PRINT operator creates an action that opens a form in print view.
Syntax
PRINT name
[OBJECTS objName1 = expr1, ..., objNameN = exprN]
[formActionOptions]
formActionOptions - additional options for this action. There are several possible option syntaxes in this operator:
printFormat [SHEET sheetProperty] [PASSWORD passwordExpr] [TO propertyId]
[PREVIEW | NOPREVIEW] [syncType] [TO printerExpr]
MESSAGE [syncType] [TOP n]
Description
The PRINT operator creates an action that prints the specified form. When printing a form in the OBJECTS block you can add additional filters for form objects to check these objects for equality to the values passed.
Parameters
-
nameForm name. Composite ID.
-
objName1 ... objNameNNames of form objects for which additional filters are specified. Simple IDs.
-
expr1 ... exprNExpressions whose values determine the filtered (fixed) values for form objects.
Additional options
-
printFormatThe print format is specified by one of these keywords:
PDF– the form will be exported to a PDF file.XLS,XLSX– the form will be exported to a file in one of the specified EXCEL formats.DOC,DOCX– the form will be exported to a file in one of the specified WORD formats.RTF– the form will be exported to an RTF file.HTML– the form will be exported to an HTML file.
-
sheetPropertyThe ID of the property whose value is used as the name of the sheet in the exported file. The property must not have parameters. It is used for
XLSandXLSXprint formats. -
passwordExprAn expression whose value determines the password that sets the read-only mode for the exported file. Used for
XLSandXLSXprint formats. -
propertyIdProperty ID to which the generated file will be written. The property must not have parameters. If a property is not specified, the generated file is sent to the client and opened by the operating system
-
PREVIEWKeyword. If specified, the form is displayed in preview mode. This mode is used by default if no other modes/formats are specified.
-
NOPREVIEWKeyword. If specified, the form is immediately (without preview) sent for printing.
-
printerExprAn expression whose value determines the name of the printer to which the print job will be sent. If no printer with the specified name is found (or specified), the default printer is selected.
-
MESSAGEKeyword. If specified, the form displays data to the user in message mode.
-
TOP nDisplays only the first
nentries. Integer literal. -
syncTypeDetermines when the created action should be continued:
WAIT- after the client completes the action (closes the preview/message form). Used by default.NOWAIT- after preparation of the information for sending to the client (form data is read).
Examples
FORM printOrder
OBJECTS o = Order
PROPERTIES(o) currency, customer
OBJECTS d = OrderDetail
PROPERTIES(d) idSku, price
FILTERS order(d) == o
;
print (Order o) {
PRINT printOrder OBJECTS o = o; // printing
LOCAL file = FILE ();
PRINT printOrder OBJECTS o = o DOCX TO file;
open(file());
//v 2.0-2.1 syntax
LOCAL sheetName = STRING[255]();
sheetName() <- 'encrypted';
PRINT printOrder OBJECTS o = o XLS SHEET sheetName PASSWORD 'pass';
//v 2.2 syntax
//PRINT printOrder OBJECTS o = o XLS SHEET 'encrypted' PASSWORD 'pass';
}