geoSCADA Expert SQL Query WHERE clause referencing a string variable in the database
EcoStruxure Geo SCADA Expert Forum
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: 2023-11-2305:59 PM
geoSCADA Expert SQL Query WHERE clause referencing a string variable in the database
The below SQL query joins tables CENETANALOG and CENETBINARY, and filters per site, in this case MRWTP (%MRWTP%), and also filters alarms that are 'SeverityType' = 2 and the relevant limits and descriptions.
What I want to know is, can I reference a string variable, eg, (%<reference string variable from database>%) which could be changed by inputting into a text box, which changes the string variable, and there by changes the query to that specific site, which updates the list.
SQL Query
( SELECT CENETANALOG.OBJECTLINK, CENETANALOG.FULLNAME, CENETANALOG.ALARMDISABLED, CENETANALOG.CURRENTVALUEFORMATTED, NULL AS STATE0SEVERITYTYPE, NULL AS STATE0SEVERITY, NULL AS STATE0DESC, NULL AS STATE1SEVERITYTYPE, NULL AS STATE1SEVERITY, NULL AS STATE1DESC, CENETANALOG.HIGH1SEVERITYTYPE, CENETANALOG.HIGH1SEVERITY, CENETANALOG.HIGH1LIMITSTD, CENETANALOG.HIGH1DESC, CENETANALOG.HIGH2SEVERITYTYPE, CENETANALOG.HIGH2SEVERITY, CENETANALOG.HIGH2LIMITSTD, CENETANALOG.HIGH2DESC, CENETANALOG.HIGH3SEVERITYTYPE, CENETANALOG.HIGH3SEVERITY, CENETANALOG.HIGH3LIMITSTD, CENETANALOG.HIGH3DESC, CENETANALOG.HIGH4SEVERITYTYPE, CENETANALOG.HIGH4SEVERITY, CENETANALOG.HIGH4LIMITSTD, CENETANALOG.HIGH4DESC, CENETANALOG.LOW1SEVERITYTYPE, CENETANALOG.LOW1SEVERITY, CENETANALOG.LOW1LIMITSTD, CENETANALOG.LOW1DESC, CENETANALOG.LOW2SEVERITYTYPE, CENETANALOG.LOW2SEVERITY, CENETANALOG.LOW2LIMITSTD, CENETANALOG.LOW2DESC, CENETANALOG.LOW3SEVERITYTYPE, CENETANALOG.LOW3SEVERITY, CENETANALOG.LOW3LIMITSTD, CENETANALOG.LOW3DESC, CENETANALOG.LOW4SEVERITYTYPE, CENETANALOG.LOW4SEVERITY, CENETANALOG.LOW4LIMITSTD, CENETANALOG.LOW4DESC FROM CENETANALOG WHERE ( "FullName" LIKE '%MRWTP%' ) AND ( ( CENETANALOG.HIGH1SEVERITYTYPE = 2 ) OR ( CENETANALOG.HIGH2SEVERITYTYPE = 2 ) OR ( CENETANALOG.HIGH3SEVERITYTYPE = 2 ) OR ( CENETANALOG.HIGH4SEVERITYTYPE = 2 ) OR ( CENETANALOG.LOW1SEVERITYTYPE = 2 ) OR ( CENETANALOG.LOW2SEVERITYTYPE = 2 ) OR ( CENETANALOG.LOW3SEVERITYTYPE = 2 ) OR ( CENETANALOG.LOW4SEVERITYTYPE = 2 ) ) ) UNION ( SELECT CENETBINARY.OBJECTLINK, CENETBINARY.FULLNAME, CENETBINARY.ALARMDISABLED, CENETBINARY.CURRENTVALUEFORMATTED, CENETBINARY.STATE0SEVERITYTYPE, CENETBINARY.STATE0SEVERITY, CENETBINARY.STATE0DESC, CENETBINARY.STATE1SEVERITYTYPE, CENETBINARY.STATE1SEVERITY, CENETBINARY.STATE1DESC, NULL AS EMPTY3, NULL AS EMPTY4, NULL AS EMPTY5, NULL AS EMPTY6, NULL AS EMPTY7, NULL AS EMPTY8, NULL AS EMPTY9, NULL AS EMPTY10, NULL AS EMPTY11, NULL AS EMPTY12, NULL AS EMPTY13, NULL AS EMPTY14, NULL AS EMPTY15, NULL AS EMPTY16, NULL AS EMPTY17, NULL AS EMPTY18, NULL AS EMPTY19, NULL AS EMPTY20, NULL AS EMPTY21, NULL AS EMPTY22, NULL AS EMPTY23, NULL AS EMPTY24, NULL AS EMPTY25, NULL AS EMPTY26, NULL AS EMPTY27, NULL AS EMPTY28, NULL AS EMPTY29, NULL AS EMPTY30, NULL AS EMPTY31, NULL AS EMPTY32, NULL AS EMPTY33, NULL AS EMPTY34 FROM CENETBINARY WHERE ( "FullName" LIKE '%MRWTP%' ) AND ( ( "State1SeverityType" = 2 ) OR ( "State0SeverityType" = 2 ) ) )
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-12-0710:28 PM
You can create an embedded list object and then store your SQL query as a string which you can concatenate to your string variable. This will update your embedded list based off the value of your variable.
See here for how to convert your SQL query to a mimic animation expression string.
See here for how to tie your SQL expression string to a database field/object such as a string variable value.