exportSbf
|
The exportSbf 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 exportSbf 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 exportSbf function supplies the data to
be exported as a single record. By specifying the recordVectors: option, the Lambda will pass data to the
exportSbf function as a collection of records saved in an aggregate container such as a Vector, Structure
or Dictionary. Usage The exportSbf function is typically used to export or convert data into formats for non-Analytic Information
Server applications. The native exportSbf 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 EOF-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 exportSbf. The exportSbf function receives the pre-formatted
text record and simply writes it out to a file. In order for the exportSbf function to work properly, the
anLambda argument is required to have a child Lambda named refExport(row):.
The result file from the exportSbf function is a text file. The optional argument, recordVectors:,
is useful when the desired result file consists of records consisting of EOF-delimited fields. When recordVectors:
is specified, the Lambda will pass an aggregate data container such as a Vector, Structure, or Dictionary to the
exportSbf function. The exportSbf 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 #\,
character. The second optional argument, recordsOnly, requires that the Lambda perform the formatting and text
conversion. If recordsOnly is specified, the exportSbf 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 exportSbf 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, exportSbf will format each item as EOF-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.
(exportSbf fileid anLambda) (exportSbf fileid anLambda recordsOnly:) (exportSbf 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 EOF delimited file. Argument: anLambda Lambda
Mandatory Lambda. The anLambda Lambda is called by the exportSbf 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, exportSbf will format each item as EOF-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 exportSbf 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 exportSbf 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 EOF = (char 1)
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
|