18.01.2015 Views

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix: Built-in Scripting Language<br />

optStrColumns<br />

optStrTags<br />

optStrOrder<br />

A string specifying which columns of the table to select. This list of column names should be<br />

comma-delimited.<br />

This is an optional parameter. If no columns are specified, then all columns of the table will be<br />

selected.<br />

A string specifying the project tags to which the columns will be mapped. This list of tag names<br />

should be comma-delimited and in the same order as the columns specified by optStrColumns.<br />

As the cursor is moved through the result set, the values in the current row are copied to these<br />

tags.<br />

This is an optional parameter. If no tags are specified, then no values will be copied.<br />

The order in which the rows will be sorted. This is equivalent to the SQL ORDER BY clause, and<br />

the string should follow the same syntax.<br />

This is an optional parameter. If no order is specified, then the rows will be left in the default<br />

order of the table.<br />

optStrErrorTag<br />

The name of a String tag that will receive detailed error messages, if errors occur during<br />

runtime.<br />

Note: The tag name must be enclosed in quotes, as shown in the syntax<br />

diagram, or else the project will try to get the value of the named tag.<br />

This is an optional parameter.<br />

Returned value<br />

Returns a numeric value that represents the cursor handle. In case of error, returns a negative number.<br />

Notes<br />

This function is equivalent to a SQL SELECT statement, except that it breaks the clauses of the statement<br />

into separate function parameters. If you know SQL and want to construct your own SELECT statement from<br />

scratch, you may use DBCursorOpenSQL instead.<br />

See also DBCursorClose.<br />

Examples<br />

As used in a Math worksheet:<br />

Tag Name<br />

nCursor<br />

Expression<br />

DBCursorOpen( "DB1", "Table1", "Column1 > 3", "Column1, Column2",<br />

"Tag1, Tag2", "Column1, Column2 DESC", "TagError" ) // Opens Table1 of DB1 and<br />

selects all rows where Column1 has a value greater than 3. Column1 is mapped to Tag1, and Column2 is mapped to Tag2. Rows<br />

are ordered first by Column1, then by Column2, in descending order. Error messages are written to TagError.<br />

DBCursorOpenSQL<br />

Selects a set of rows and columns in a database table, initializes the cursor at the first row of the result set,<br />

copies that row's values to mapped tags, and then returns a cursor handle that can be referenced by other<br />

DB/ERP functions. (This function is equivalent to a SQL SELECT statement.)<br />

Function Group Execution Windows Embedded Thin Client<br />

DBCursorOpenSQLDatabase/ERP Synchronous Supported Supported Supported<br />

Page 744<br />

<strong>InduSoft</strong> Web Studio

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!