importTab

 

 

Overview

The importTab function with its Lambda argument provides powerful programmable export functionality. The Lambda performs any necessary editing of the imported records, and may be programmed to process any header or trailer records that an incoming file may have. The importTab function natively parses tab-delimited fields, but again, can be programmed to parse any record with no fields or any record with fields that are delimited by any character. The only assumption made by the importTab function, is that the file is a text file and that each record is separated by a line terminator eol (end-of line) character that applicable to the operating system.

The Lambda is responsible for supplying a container to accept the imported fields. The container must be appropriate to handle the type of data it is to receive. By specifying the {recordsOnly:} argument, the Lambda of importTab function makes the assumption the data to be imported as a single record that is terminated by the eol character. By specifying the {recordVectors:} option, the Lambda will make the assumption that the data it is receiving from the importTab function is a collection of fields, therefore the container must be an aggregate container such as a Vector, Structure or Dictionary to accept multiple fields.

Usage

The importTab function is typically used to import or convert data from non-Analytic Information Server applications. The native importTab 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)where the data should go nor does it have any built-in editing algorithms for the imported data. The Lambda handles the container and editing issues. In order for the importTab function to work properly, the Lambda argument must be supplied and must have the refImport(row) and the setImport(row) child Lambdas.

refExport ChildLambda

refExport(row) Called by importTab function to receive an empty container from the Lambda. The refImport method receives a row argument and must return an empty container. The empty container will be used to store the next imported record.
setImport(row container) Called when importTab is finished filling the record with data. The setImport function receives a row index argument and a record argument. The record argument is the filled container record. The Lambda may process the filled container in any manner.

The only requirement of the importTab function is that the imported file must be text. The optional argument, recordVectors:, is useful when it is known by the Lambda that the records consists of tab-delimited fields. When recordVectors: is specified, the record is automatically parsed and the individual fields are stored as items in an aggregate container, such as a Vector, Structure, or Dictionary. The Lambda establishes the container type and it is passed from the Lambda to the importTab function via the refImport method. When the importTab function is finished filling the container it passes the filled-in container to the Lambda, setImport method then receives the container and performs the desired formatting or editing.

 

Syntax


Expression:

(importTab fileid anLambda)

(importTab fileid anLambda recordsOnly:)

(importTab fileid anLambda recordVectors:)


Arguments Name Type Description
Argument:fileidText A file identifier previously obtained from a call to fileopen for an Lambda tab delimited file.
Argument:anLambdaLambda Mandatory Lambda. An Lambda which is to be imported in tab delimited format. If an object Repository may be passed, the Object repository's Librarian will be used as the import Lambda.
Argument:recordsOnly:Symbol Optional argument.. If present, the importTab 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 importTab 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:

The number of rows imported.



 

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