exportSbf

 

 

Overview

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):.

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.

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.

 

Syntax


Expression:

(exportSbf fileid anLambda)

(exportSbf fileid anLambda recordsOnly:)

(exportSbf fileid anLambda recordVectors:)


Arguments Name Type Description
Argument:fileidText A file identifier previously obtained from a call to fileopen for an Lambda EOF delimited file.
Argument:anLambdaLambda 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:

The number of rows exported.



 

Examples

Here are a number of links to Lambda coding examples which contain this instruction in various use cases.

 

Argument Types

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.

++ += + /=
/ *= * --
-= - abortTransaction addMethod
addi appendWriteln append apply
argCount argFetch attachLibrarian avg
badd balance bcompareEQ bcompareGE
bcompareGT bcompareLE bcompareLT bcompareNE
bdiv beginTransaction binaryInsert binaryNand
binaryNor binaryNot binaryNxor binarySearch
bitToNumberVector bitwiseAnd bitwiseNand bitwiseNor
bitwiseNot bitwiseNxor bitwiseOr bitwiseShiftLeft
bitwiseShiftRight bitwiseXor bmod bmul
boolean cadd callcc ccompareEQ
ccompareGE ccompareGT ccompareLE ccompareLT
ccompareNE cdiv cdr char
character checkPointTransaction class clean
clear closeLog cmod cmul
code commitTransaction compareEQ compareGE
compareGT compareLE compareLT compareNE
compare comparison compile compress
cons copy count csub
date day days360 debugBrowsableProcs
debugDetective debugEval debug defchild
defclass define(macro) defineStructure define
defmacro defmethod deforphan defriend
defstruct defun deleteRows delete
detachLibrarian dimension disassemble display
divi downcase encode evalInSyncLocalContext
eval exit exportCsv exportSbf
exportTab fact fdisplay fieldsOf
fileClose fileCopy fileDir fileDisplay
fileEraseDir fileErase fileExists fileMakeDir
fileOpen fileReadAll fileReadRecord fileRead
fileResize fileSeek fileSizeOf fileWriteAll
fileWrite filewriteln findBlock find
floor fraction freeBlock gc
gcd getRecursionCount globalBinding hashString
hour iadd icompareEQ icompareGE
icompareGT icompareLE icompareLT icompareNE
idiv imod importCsv importSbf
importTab imul insertRows insert
inside inspect integer isAtom
isBitVector isBoolean isBound isByteVector
isCharAlphabetic isCharAlphanumeric isCharLowercase isCharName
isCharNumeric isCharUppercase isCharWhitespace isChar
isCharacter isClass isComplex isDate
isDictionary isDirectory isEqual isError
isEven isExact isFloatVector isIdentical
isImmediate isInexact isInside isIntegerVector
isInteger isLambda isMatrix isMember
isMoney isNegative isNull isNumberMatrix
isNumberVector isNumber isObjectVector isObject
isOdd isPair isPcodeVector isPositive
isString isStructure isSymbol isText
isTransaction isType isVector isZero
isub julian kurtosis lambda
lcm left length lisp
list loadModule loadRepository loadWorkspace
logConsole macroReplace makeDictionary makeGramMatrix
makeLambda makeQuotedList makeQuotedSymbol makeStructure
map mapc max median
member methodsOf mid min
minute mod modi money
month morph muli myself
ncompareEQ ncompareGE ncompareGT ncompareLE
ncompareLT ncompareNE new number
objectToDictionary objectToList objectToMatrix objectToNumMatrix
objectToNumVector objectToStructure objectToVector offset
onError openLog pair parent
parse pointer preAllocateFixedMemoryBlocks product
proprecord putprop qt quit
random randomize range rank
refAttributes refLibrarian refValues ref
remProp remove rename replace
rept reset resize reverse
right round run saveImmediate
saveModule saveObject saveRepository saveWorkspace
second send setAttributes setBlock
setCar setCdr setLastCdr set
setf setq sizeof skew
sort sql sqrt srandom
stdev stdevp stringCiEQ stringCiGE
stringCiGT stringCiLE stringCiLT stringCiNE
stringFill stringToBVector stringToVector string
subi submit substitute substringCiEQ
substringCiGE substringCiGT substringCiLE substringCiLT
substringCiNE substringEQ substringFill substringGE
substringGT substringLE substringLT substringNE
substring sum sumsqr super
svmRegression symbolToTypeCode symbol systemCheck
system text time trim
type uniqueInsert upcase var
varp vectorBinaryInnerProduct vectorBipolarInnerProduct vectorCosineInnerProduct
vectorCubeInnerProduct vectorDelete vectorExpInnerProduct vectorFill
vectorInnerProduct vectorLogInnerProduct vectorQuartInnerProduct vectorQuintInnerProduct
vectorSigmoidInnerProduct vectorSineInnerProduct vectorSquareInnerProduct vectorTanInnerProduct
vectorTanhInnerProduct version writelg writeln
year

Analytic Information Server (AIS)

AIS Component Systems

  • Smartbase Engine
  • QT C++ Libraries
  • MySQL Relational Database
  • AIS Lisp Libraries
  • Rapid Analytic Demo IDE