mySCADA
myDESIGNER › myDESIGNER › Connections & Protocols

Databases - Reading values from SQL database

On this page

Once you have added the connection, you can now use values from the database anywhere in the mySCADA project. To do so, please follow the described syntax.

Imagine the following SQL query

SELECT ID,COLUMN1, COLUMN2, COLUMN3 FROM table_name

To retrieve data from this query you can:

1. Specify directly column name COLUMN1@alias Will retrieve values as array from column with name COLUMN1.

2. Specifying a column position with keyword COL COL[1]@alias Will retrieve values as array from first column.

3. Specifying column name and row index COLUMN2[5]@alias Will retrieve value from column with name COLUMN2 on 5th row.

4. Specifying column name with a condition (supported operators are: =,<,>) COLUMN1[ID>1]@alias Will retrieve values from first column; only rows with column named id is greater then 1 will be processed.

5. Specifying a row position with keyword ROW ROW[1]@alias Will retrieve first row of values and return them as array

6. Specifying a row with a condition (supported operators are: =,<,>) ROW[id=5]@alias Will retrieve values from first column; only rows with column named id is greater then 1 will be processed.