''RecordQueryDataSource'' Element

Top  Previous  Next

RecordQueryDataSource is used a to define data source that queries the records of text files. The records of the text file are read one by one and the fields that are either separated with separators or has fixed portions on records are transferred to the ADOM of the data source.

By referring to the values of the mapped fields of to the other MScript symbols the input records can be processed conditionally. For each input record that satisfies the Record Selection Precondition an output ADOM node is created.

RecordQueryDataSource_pe

Properties

Input File Name (Accepts MScript)

The name of the text file to be read. It can be absolute or relative to the root directory of the web application.

Input File Encoding (Accepts MScript)

The encoding of the input file.

Value Extraction | Fields (Accepts MScript)

Options:

1.Are Separated with Separators
If the field values are separated with separators on the records on the file as it is the case for MS Excel files with *.csv extension, use this option.
2.Has Fixed Portions
If the field values have fixed lengths and exist on fixed positions on the records, use this option.
 

Value Extraction | Separator

The value of the "Value Extraction | Fields" property is "1" a separator should be defined in this property.

Value Extraction | Field Mappings (Accepts MScript)

With the definitions made in this property, the fields, either separated with separators or have fixed portions, are mapped to pool variable. Each mapping definition either should be separated with ';' characters or should reside on a different line.

Definition syntax:

If the value of "Value Extraction | Fields" property is "1":

field-name : sequence-number or column-name or mscript-expression

 

If the value of "Value Extraction | Fields" property is "2":

field-name : start-position, length

 

field-name
The name of the field to map

 

sequence-number
The sequence number of the field starting from "1".

 

column-name
It is an alternative to the sequence-number and used to identify the columns with column names that increment in "A,B,C,,,,,Z,AA,AB,," order as it the case in MS Excel spreadsheets.

 

mscript-expression
MScript expressions can be used to define the exact value to map. The column names and the current record symbol "LINE" can be used as variables.

 

start-position
The start character position of the field in "Fixed Portions" mode.

 

length
The length of the field in "Fixed Portions" mode.

 

Examples:

Mapping with field sequence number

ID:1; NAME:2; DESC:4 

Mapping with column name

ID:A; NAME:trim(B); DESC:repl(C,'*','-') 

Mapping with fixed portions

ID:1,6; NAME:8,20; DESC:trim(sstr(LINE,35,80)) 

 

Record Selection Precondition

A precondition to select the current input record to process.

The value of this property must be a valid MScript test expression. The mapped fields and other MScript symbols can be used within the expression. Additionally, a variable named LINENUM that holds the current line number, can also be used.

Examples:

(ID != '') and (NAME != '')  @// If ID and NAME is not empty

LINENUM > 1                 @// If Input Record Count is greater than 1

'@sstr(NAME,1,3)' = 'OEM'    @// If the first 3 characters of the NAME field is 'OEM'

 
Other Properties

"Scope", "Refresh Timeout", "Execution Precondition", "Items Per Page", "Pages Per Block" and "Debug" properties are standard data source properties and you can refer to main help file for the details.