Schneider Electric support forum about installation, configuration, integration and troubleshooting of EcoStruxure Geo SCADA Expert (ClearSCADA, ViewX, WebX).
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send InviteCancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2019-11-0512:50 PM. Last Modified: 2023-05-0312:36 AM
[Imported] Embedded SQL Statement Within ST Query
>>Message imported from previous forum - Category:ClearSCADA Software<< User: florian, originally posted: 2018-10-24 21:06:14 Id:205 This is a re-posting from the obsoleted (October 2018) "Schneider Electric Telemetry & SCADA" forum.
---------------
**_NIWTelemetry:_** **_Hello, Looking for some assistance._**
**_I am trying to develop a Structured Text logic program to_**
**_1 identify analogue points related to certain geographic areas by SQL query_**
**_2 disable the alarms on those points via a Method_**
**_grateful for any assitance or examples to get me started. I imagine there is a Type / End_Type block at the top of the ST with a SQL statement producing a record set then a DO statement looping through the record set calling the method._**
**_Thanks_**
-----
AWoodland: You'll need two logic programs chained together.
The first logic program has the %S in with the query to get the list of the FullName that you're interested in, loop through the returned data and call the execute method on the second logic program. The second logic program (execute on interval, with interval of 0) takes the fullname as an input parameter, uses that input to define the method, i.e. Something AT %M({FullName}.Method); and then call that method.
The first level program would execute once, the second level one would execute multiple times all triggered from the first one (depending on how many points to process you may need to increase the max queue size on the second logic program).
Depending on how you want to control the geographic reason you can pass that in as an input to the first logic program
--------------
bevanweiss: I think this would be possible with just one query.
_VAR NOCACHE_ _MyObjects AT %S(SELECT O.Id FROM CAlarmObject O WHERE O.GEOPosition WITHIN (SELECT R.GeoRegion FROM _CGISRegion R WHERE R.FullName = 'MyRegion')) : RESULTSET OF AlarmObject;_ _END_VAR;_
Note: This code is untested.. and also there's this warning... UNEXPECTED EQUIPMENT OPERATION
ClearSCADA is not suitable for controlling safety-critical systems and must not be used unilaterally to do so. ClearSCADA is not tested for, nor has any approval for use in, the control of safety-critical systems. Safety-critical systems should be controlled by an approved safety-critical platform that is installed independently of ClearSCADA.
The configuration of this product requires expertise in the design, configuration and programming of SCADA control systems. Only persons with such experience should be allowed to configure ClearSCADA. Only persons with the appropriate programming experience should be allowed to write any scripts, Logic programs, expressions, or SQL queries intended for use in ClearSCADA.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
------------------------
**_NIWTelemetry:_** **_Thank you - very useful!_**
----------------
**_NIWTelemetry:_** **_Thank you all for your comments!_**