Example Lambda importTab 001
|
The stockLambda Lambda is a simple Lambda that reads a file, and imports the data into
an in-memory table that is represented as an Object Vector. Each item in the object Vector is a
record.
Notes and Hints
(defun StockLambda()
pvars: (rowCount colCount rowVector colVector)
(defun doClear() ;; Manage clear at start of import.
(setq rowCount 0) (setq colCount 0)
(setq colVector #void)
(setq rowVector (^new Vector: object: 0) ) )
(defun setImport(row record)
(setq rowVector[row] record) ;; Install the data in a vector
(setq rowCount row) ;; Update the row count
rowCount) ;; end of setImport
(defun refExport(rowIndex)
(if (>= rowIndex rowCount) (return false)) ;; Return "false" to stop the export
(return rowVector[rowIndex] ) ) ;; Pass a filled record to exportTab.
(defun refImport(row)
(return (^new String: 256) ) ) ;; Pass an empty string container to importTab.
(defun refRowCount() rowCount)
(defun refColCount() colCount)
) ;; end of StockLambda
Returns:
(define myLambda (new StockLambda) ) ;; Create a new instance of the StockLambda
(AnLambda.doclear) ;; initialize persistent variables
(setq fileid (fileOpen stocks.sbf 0 0)) ;; Open an existing text file
(importTab fileid myLambda recordsOnly:) ;; import the file
(fileClose fileid 1); ;; Close the file
(myLambda.refRowCount) ;; Ask the Lambda for a row count
Returns:
Here are examples of the importTab function at work.
Lambda importTab 001 | ObjectRepository importTab 001 |
Here is the link to the current function used in this example.
Here are a number of links to other related functions.
exportTab(#void) |
Here are the links to the data types of the arguments used in this example. Here are a number of links to examples having similar argument types.
Lambda
Record
Symbol
Analytic Information Server (AIS)AIS Component Systems
|