WRITEFIELDS

Usage

TIBCO iProcess Workspace (Windows)

Warning: (iProcess only) This expression is not available to the TIBCO iProcess Script Server Plug-in. Therefore, even though you can successfully enter the expression in your iProcess Script plug-in definition, it will not be processed by the iProcess Engine. It will return SW_NA.

Write current values of selected fields to a file.

Syntax

WRITEFIELDS (filename, fieldlist, excluding, copy, destfmt)

where:

filename is a text string specifying the output file as either a pathname, a simple filename or the full path of the directory for the file, in which case a unique filename will be generated (and returned by the function).

The following environment variables may be used in a pathname:

TEMP, the temporary directory on the client.
HOME, the user’s queue directory on the server, SWDIR\queues\username.
Note: This directory is not created automatically. This means that before using this environment variable you should check that it exists, otherwise the function will fail.
fieldlist is a text string specifying the list of fields to be written, separated by commas. (Wildcard characters * and ? may be included.)
excluding is a text string specifying the list of fields not to be written, even though selected in fieldlist.
copy is one of the following numeric values, specifying whether to make copies of memos and/or attachment files:

Value

Files to copy

0

Copy neither

1

Copy memos

2

Copy attachments

3

Copy both memos and attachments

Note: Memos and attachment files are copied to the same directory as the output file under their original names, and their new pathnames written to the output file as the values of the fields. If they are not copied, their original pathnames are written to the output file. (If not copied the files may not be available to the client, or may be deleted or changed.)
destfmt is one of the following numeric values, specifying the destination format of the output file filename:

Value

Destination format

0

Current client

1

UNIX

3

DOS type

Note: This affects line-terminator characters.

Returns

A text string containing the full pathname of the output file, or SW_NA on error.

The output file is a text file in abox format - each line consists of the fieldname, followed by a comma, followed by the field value in characters. Passwords are not written.

Example

TIBCO iProcess Modeler:

This (Windows) example writes the contents of all fields excluding (SW_*) system fields with DOS line terminators to a computer-generated filename in the directory specified by the TEMP environment variable, and puts the full path of the output file in text field abox. Any memos and attachment files will be copied to the same directory and their pathnames written to the output file.

abox := WRITEFIELDS("%TEMP%", "*", "SW_*", 3, 3)

TIBCO Business Studio:

abox = IPEEnvironmentUtil.WRITEFIELDS("%TEMP%", "*", "SW_*", 3, 3);