Question:
How can I create a filter for an SQL Server’s query with an ODBC connection?
Solution:
To do so, you must use table’s SQLQuery() function. Records can be selected with functions such as MoveNext, MovePrev, etc, and filters can be accessed directly via AppBrowser.
Examples of filters:
Search for all records with “Maria” in Name field, in ascending order, and return records under ‘result’:
result = Database1.SQLQuery(“name = ‘Maria’”,”name”)
No filter. Please notice strings can have either quotation marks or apostrophes.
Database1.SQLQuery(” “)
Search for all records whose string in Name field is larger than ‘Mary’, and whose string in ‘salary’ field is higher than 1000. Both filters must return valid values.
Database1.SQLQuery(“name > ‘Mary’ AND salary > 1000”)
There are several other examples of filters in Elipse SCADA’s User Manual, as well as complete description of SQLQuery function.