AVEVA Plant SCADA Forum
A support forum for AVEVA Plant SCADA (formerly Citect SCADA). Share new and exciting product information, connect, learn, and collaborate with the ecosystem of Plant SCADA Users. AVEVA Plant SCADA a reliable, flexible and high-performance Supervisory Control and Data Acquisition software solution for industrial process customers. This forum is to connect, share, learn and collaborate new and exciting product information. Feel free to join and share to your Ecosystem of Plant SCADA Users.
Posted: 2021-04-05 11:49 AM
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-04-08 11:15 AM . Last Modified: 2021-04-08 11:29 AM
Hell Jesper,
You can use {} to enclose tags in a DBExecute script command.
For example:
SELECT * FROM {MyTag}.trend001
However, you want to change the database?
You can change the database/ERP reference in the DB Execute.
$DBExecute($MyDBConnection, "SELECT * FROM trend001")
Where $MyDBConnection is a string which contains the of the Database/ERP connection name that you created.
@Anonymous user wrote:
Hello
How is it possible to use tags in SQL statements in Machine SCADA Expert?
If I e.g. want to change the database the select is made in.
SELECT * FROM [TAG].trend001
Best regards
Jesper
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-04-08 11:15 AM . Last Modified: 2021-04-08 11:29 AM
Hell Jesper,
You can use {} to enclose tags in a DBExecute script command.
For example:
SELECT * FROM {MyTag}.trend001
However, you want to change the database?
You can change the database/ERP reference in the DB Execute.
$DBExecute($MyDBConnection, "SELECT * FROM trend001")
Where $MyDBConnection is a string which contains the of the Database/ERP connection name that you created.
@Anonymous user wrote:
Hello
How is it possible to use tags in SQL statements in Machine SCADA Expert?
If I e.g. want to change the database the select is made in.
SELECT * FROM [TAG].trend001
Best regards
Jesper
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-04-08 11:42 AM
HI,
Yes it is possible to add tags to your SQL query. there are 3 options available.
Option 1:VB Script or Function where you can use VB Variables to build the query and then the $DBExecute function. something like this:
Dim SQL
SQL = "SELECT FROM Table WHERE Column = " & $TagName
$DBExecute("Connection",SQL)
Option 2: You can also use the script database command $DBSelect command with the syntax below.
DBSelect("DB1","Table1","Array1,Array2","Column1,Column2","","")
Option 3: You can use the database worksheets in the Tasks->Database/ERP folder, the condition field would be your select where from would be.
Hopefully this helps!
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-04-08 11:32 PM . Last Modified: 2021-04-08 11:33 PM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-04-08 11:32 PM . Last Modified: 2021-04-08 11:33 PM
Thanks Paul and Tom
This was just what I was looking for.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.