EcoStruxure Geo SCADA Expert Forum
Schneider Electric support forum about installation, configuration, integration and troubleshooting of EcoStruxure Geo SCADA Expert (ClearSCADA, ViewX, WebX).
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-08-25 04:13 AM . Last Modified: 2023-05-03 12:01 AM
Simpe answer i hope. Im trying to have buttons execute a mimic script but change the variant, where pVariant is the ID
-script-
SELECT
Recordtime
FROM
CDBHISTORIC
WHERE
ID = pVariant AND
Recordtime BETWEEN { OPC 'Y' } AND { OPC 'Y + 1Y' } AND
STATEDESC = 'Running'"
end sub
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-08-25 04:41 PM
There are a few ways to do it, but where is pVariant coming from? Is it a point value, is it an input from the user?
Once you have that value and have validated it (i.e. it is only an integer) then you can just do some simple string concatenation to get the SQL you need, i.e.
"SELECT columns FROM table WHERE id = " & pVariant & " AND something = somevalue"
Then use Server.Query to execute it and get the results, the help has that info in.
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-08-29 03:38 PM
As Adam mentioned, if you really need this in your script, you can do it that way.
But... if you want to display it for a user, then you probably want to use an animation for the SQL expression on an embedded query list.
You could do something like:
'SELECT
Recordtime
FROM
CDBHISTORIC
WHERE
ID = ' + REGISTRY("RegistryLocationWhereYouHavepVariantStored", -1) + ' AND
Recordtime BETWEEN { OPC 'Y' } AND { OPC 'Y + 1Y' } AND
STATEDESC = ''Running'''
NOTE: single quotes within the SQL need to be escaped as two single quotes (i.e. 'Running' -> ''Running'')
Then if you had a button to change the variant, it could simply set the registry value. The animation 'plumbing' is normally good for this, when your button changes the registry field, then the animations based on that are updated (I've never had it fail... outside of bug situations).
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.