exportTab
|
The exportTab function with its Lambda argument provides powerful programmable export functionality. The
Lambda performs any necessary editing, and may be programmed to generate any header or trailer records that may be
necessary. The exportTab function natively generates text records to a specified file. Each record is
separated by a line terminator eol (end-of line) character that applicable to the operating system. By specifying the recordsOnly: argument, the Lambda of exportTab function supplies the data to
be exported as a single record. By specifying the recordVectors: option, the Lambda will pass data to the
exportTab function as a collection of records saved in an aggregate container such as a Vector, Structure
or Dictionary. Usage The exportTab function is typically used to export or convert data into formats for non-Analytic Information
Server applications. The native exportTab makes no assumptions of the format of the foreign data (it may
have header records or not, it may have trailer records or not, the output fields may be tab-delimited, or comma-delimited,
or have no fields at all). The Lambda specified as the anLambda argument is the Lambda handles the formatting and
editing details and passes the record to exportTab. The exportTab function receives the pre-formatted
text record and simply writes it out to a file. In order for the exportTab function to work properly, the
anLambda argument is required to have a child Lambda named refExport(row):.
The result file from the exportTab function is a text file. The optional argument, recordVectors:,
is useful when the desired result file consists of records consisting of tab-delimited fields. When recordVectors:
is specified, the Lambda will pass an aggregate data container such as a Vector, Structure, or Dictionary to the
exportTab function. The exportTab function will extract each item from the Vector, Structure, or
Dictionary and convert each item into text and enter it in a record, separating each data item with a #\tab
character. The second optional argument, recordsOnly, requires that the Lambda perform the formatting and text
conversion. If recordsOnly is specified, the exportTab function will call the Lambda's refExport and will
expect a single text record and will simply write out the record. refExport ChildLambda
refExport(row)
Called by exportTab function to request a record or vector from an Lambda. The refExport method receives a
row argument and must return one of the following containers, String, Vector, Structure or Dictionary. If the
container is a Vector, Structure or Dictionary, exportTab will format each item as tab-delimited text fields
in a record and then write out the record to the file. The refExport method is required to return a Boolean
value of false to indicate that no more records are to be exported.
(exportTab fileid anLambda) (exportTab fileid anLambda recordsOnly:) (exportTab fileid anLambda recordVectors:) The number of rows exported.
Expression:
Arguments
Name
Type
Description Argument: fileid Text
A file identifier previously obtained from a call to fileopen for an Lambda tab delimited file. Argument: anLambda Lambda
Mandatory Lambda. The anLambda Lambda is called by the exportTab function to request a record or vector from
an Lambda. The anLambda Lambda must have a child Lambda named refExport. The refExport method receives a row
argument and must return one of the following containers, String, Vector, Structure or Dictionary. If the
container is a Vector, Structure or Dictionary, exportTab will format each item as tab-delimited text fields
in a record and then write out the record to the file. The refExport method is required to return a Boolean
value of false to indicate that no more records are to be exported. Argument: recordsOnly: Symbol
Optional argument.. If present, the exportTab function sends the Lambda a record that is delimited by the
system end-of-line (eol) character. Note: In the Intel-base platforms, the standard record terminator is
carriage-return, line-feed (CR)(LF). 68000-based platforms (such as the Mac OS) use a single eol character:
(CR). Argument: recordVectors: Symbol
Optional argument. If present, the exportTab function sends the Lambda a Vector or other aggregate container.
The individual elements of the vector are converted to text and each text fields is separated by the #\tab (tab)
character.
Returns:
Here are a number of links to Lambda coding examples which contain this instruction in various use cases.
Here are the links to the data types of the function arguments.
ObjectRepository | Text | Lambda | String |
Vector | Structure | Dictionary | Boolean |
Integer |
Here are also a number of links to functions having arguments with any of these data types.
Analytic Information Server (AIS)AIS Component Systems
|