Description | With this action you can read a record from a table or view of a database. |
Required licence | Database Feature |
Please note:
Custom database queries as a view: If you use your own complex database queries over several tables (join), create them as a view in the database. You can then use them in the DataSuite and define a Where condition.
Please note:
Always only the first data record: With this action, only the first data record that fulfils the specified condition is queried from the database (Top 1).
1 | Database | Select the database you want to read from. |
2 | Data Source | You can either read from a table or view (predefined select query). |
3 | Table/View | Select the desired table or view. Depending on point 2. |
1 | Mapping | After you have selected a table or view, all columns are loaded from the database and you can assign each of them to a variable. If you do not want to write a column into a variable, you can simply deactivate it using the switch. |
1 | Where | A database table usually consists of many records. With the where condition, you can select the desired record. To do this, simply enter the condition. The condition must be specified in the SQL syntax of your database. You can also use variables in the condition (see Use variables). |
1 | Filter | If you have an array of length 100 in the PLC, for example, but only the first 50 entries are written, you can select here which data is written. To determine whether a data set contains data, the individual values within the data set are checked. A data set contains data as soon as a value deviates from the default value of the data type. Use all: All records are used. No check is performed to see if data is included. Remove empty records: Each record is checked individually and used only if data is contained. For example, if all 100 records are written and only the record at index 50 is empty, it is removed and all other 99 records are written. Continuous records only: Once an empty record is found, it and all others are removed. For example, if all 100 records are written and the record at index 50 is empty. Only the data records from index 0 to index 49 are used, although data record 51 also contains data. |
2 | No data available | If there are no records, you can use this option to select whether the trigger should then be aborted with an error or not. |