READFIELDS

Usage

TIBCO iProcess Workspace (Windows)

This function is also used with batch-oriented broker applications. For example, a TIBCO BusinessWorks service running as an iProcess broker via SSO use READFIELDS (in the step Initial script) on a file stored in SWDIR.

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.

Read values of selected fields from a file.

Syntax

READFIELDS (filename, fieldlist, excluding, delete, srcfmt)

where:

filename is a text string specifying the input file as a pathname or simple filename.

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.
SWDIR, the iProcess system directory where the TIBCO iProcess Engine is installed.
fieldlist is a text string specifying the list of fields to be read, separated by commas. (Wildcard characters * and ? may be included.)
excluding is a text string specifying the list of fields not to be read, even though selected in fieldlist.
delete is a numeric value specifying which files to delete after reading data:

Value

File(s) to delete

0

Delete no files

1

Delete memo files

4

Delete input file

5

Delete both memo files and input file

srcfmt is a numeric value which is ignored in a standard installation (set to 0).

Returns

One of the following numeric values:

Value

Description

0

Error

1

Success

The input file is a text file in abox format, i.e. each line consists of a fieldname, followed by a comma, followed by the field value in characters. Variables in the input file must be in uppercase.

Note: For a Memo field, the value is the pathname of a text file containing the memo text; for an attachment field, the value is the pathname of the attachment file.

Examples

TIBCO iProcess Modeler:

This (Windows) example reads all field values from abox file DATA in the directory specified by the TEMP environment variable, deleting any memo files and the abox file after completion.

READFIELDS("%TEMP%\DATA","*","",5,0)
Note: If READFIELDS encounters any fields in the file which are not defined in the process, these fields are ignored and no errors are flagged (in particular, file SWDIR\logs\sw_warn is not updated).

TIBCO Business Studio:

IPEEnvironmentUtil.READFIELDS("%TEMP%\\DATA","*","",5,0);