The Select Method of the ODAX ActiveX Object is used to query .XML- and .CSV-based database files. The method performs the SQL SELECT statement on the specified file and populates the object's result set.
Select (Method of the ODAX ActiveX Object) Syntax var count = object.Select(sql_statement, delimiter, firstrow);
Parameters
Items listed in this section indicate parameters, or attributes which can be set.
Name Possible Values Description
Default Value Sql_statement String String representing the SELECT SQL statement to be executed N/A Delimiter Character Delimiter which is used in CSV files as a column separator. Even though there is no special use for this in XML files you cannot leave this blank, hence you need to provide a valid value N/A FirstRow True or False This denotes that the first row of a CSV file contain the Column Names. If set to false in CSV mode it will retrieve columns as column1, column2 etc N/A
Return Values
Name Description Count Returns the number of record in the result set or a negative error number (Please Refer Error Codes for More Detail)
Examples
The following javascript selects all records from a XML file:
<script> var ax = new ActiveXObject("CeODAX.ODAX"); var count = ax.Select('SELECT * FROM \'\\application\\test.xml\';', ',', false); </script>
Copy example to clipboard
Remarks
GeneralIf the file is in CSV format, the delimiter and firstrow parameters will be used. Only single character delimiters will be used. If firstrow is specified the control expects the first row of the file to contain a list of field names. If firstrow is not set, field names will default to column1, column2 etc. Only the equality ('='), AND and OR operators are supported (e.g. WHERE (field1='apples') AND ((field2='pears') OR (field3='oranges'))). Brackets must be used to supply operator precedence (e.g. the '=' operator needs to have precedence over the 'AND' operator (note: this is compulsory) and the 'OR' operator has precedence over the 'AND' operator). Specific fields are not specified in the SELECT statement - as data is retrieved from the result set by field name, this feature is superfluous.
Additional Information
Supported Platforms Windows Mobile, Windows CE Persistence Runsimmediately Min. Requirements None.