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: 2022-06-01 09:56 PM . Last Modified: 2023-05-02 11:56 PM
Hello,
I'm trying to create some basic SQL exports so that I can export data on a schedule.
The data i'm wanting to export are part of templates and I was wondering is it possible
to use relative linking inside the SQL queries so that the export can be templated so when a new instance is
created the export+schedule is already configured.
Something along the lines of Select * from CDBHistory where "Id" = "..Pump1.Running.ID" and RELATIVE TIME BETWEEN....etc .
Is it also Possible to use a relative pathname in the SQL Export filename so that the export file name
will be unique for every instance created?
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: 2022-06-06 02:06 AM
In a template, edit property overrides.
Then choose Select and add the SQLQuery property of the SQl Export object in the template.
Find that in the list of properties and change the Override Type from 'In Instance' to 'By Expression'.
Then in the Expression field you can type your SQL query as a string (wrap with single quotes) and use the variable FullName in the filter. Use double single quotes to escape a single quote in a string.
e.g.
'SELECT TOP( 100000 ) "RecordId", "SeverityDesc" AS "~SeverityDesc", "RecordTime" AS "~RecordTime", "Source", "Message", "User", "Category", "Foreground", "SeqNo", "CommentNo" FROM CDBEVENTJOURNAL WHERE ( "~RecordTime" BETWEEN { OPC ''H-23H'' } AND { OPC ''H+1H'' } ) AND ( "Source" LIKE ''' + FullName + '.%'' OR "Source" = ''' + FullName + ''' ) AND ( "Deleted" = FALSE ) ORDER BY "~RecordTime" DESC, "SeqNo" DESC, "CommentNo" ASC'
The above query gets the events for the instance of the SQL Export.
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: 2022-06-04 05:06 PM
I haven't tried this, but it may be possible to use the newish Template Parameter stuff to do it (although I can't remember the exact limitations to this, it would at least let you simplify the configuration).
The other way I've done similar is with a really long interval OnInterval logic routine within the template.
When it's instantiated, it gets executed, which then configures the various settings you want.
It's not super nice though, so I'd look into the Template Parameter stuff first..
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: 2022-06-06 02:06 AM
In a template, edit property overrides.
Then choose Select and add the SQLQuery property of the SQl Export object in the template.
Find that in the list of properties and change the Override Type from 'In Instance' to 'By Expression'.
Then in the Expression field you can type your SQL query as a string (wrap with single quotes) and use the variable FullName in the filter. Use double single quotes to escape a single quote in a string.
e.g.
'SELECT TOP( 100000 ) "RecordId", "SeverityDesc" AS "~SeverityDesc", "RecordTime" AS "~RecordTime", "Source", "Message", "User", "Category", "Foreground", "SeqNo", "CommentNo" FROM CDBEVENTJOURNAL WHERE ( "~RecordTime" BETWEEN { OPC ''H-23H'' } AND { OPC ''H+1H'' } ) AND ( "Source" LIKE ''' + FullName + '.%'' OR "Source" = ''' + FullName + ''' ) AND ( "Deleted" = FALSE ) ORDER BY "~RecordTime" DESC, "SeqNo" DESC, "CommentNo" ASC'
The above query gets the events for the instance of the SQL Export.
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.
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.