EcoStruxure Geo SCADA Expert Forum
Schneider Electric support forum about installation, configuration, integration and troubleshooting of EcoStruxure Geo SCADA Expert (ClearSCADA, ViewX, WebX).
Posted: 2020-03-12 09:06 AM . Last Modified: 2023-05-03 12:16 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-03-12 09:06 AM . Last Modified: 2023-05-03 12:16 AM
Hello
I would be grateful if someone could help me write a script which updates a query list say every 10 seconds.
I tried
Public Sub Mimic_Refresh
While true
Mimic.Layers("Mimic").Item("Lst_1").sql = Mimic.Layers("Mimic").Item("Lst_1").sql &" "
Sleep 10000
Wend
End Sub
But does not work.
Grateful for any help
Thanks
Tdog
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: 2020-03-12 11:27 PM
I agree with Adam, this is not what scripting is intended for.
If you want an SQL query on the page to be updated every so often, then you will need the animation property for it to change. This can be done by having the SQL animation include a meaningless point reference where that point is updated every X seconds.
The demo database has a horrible 'clock' example which has a noisy point that does something every second (I believe). So you could add that to the animation.
Something like
'SELECT stuff you care about
FROM place you care about
WHERE things you care about are true AND (' + "PointValue" ' > -1 OR TRUE)'
In this way the query is different every x seconds, but the result of the query is still the same.
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: 2020-03-12 02:33 PM
That's not what scripting is for, it is single threaded and can be aborted by another scripting running.
What is the SQL doing/showing? If you're referencing database objects and include the id field the row content should update automatically. If its a data table/grid then it won't auto update.
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: 2020-03-12 03:29 PM
Hi adamwoodland
Perhaps if you look at this link
https://www.se.com/ww/en/faqs/FA383074/
This is close to what I wish to achieve only I would like to automate the query refresh at regular intervals.
surely the code fragment detailed in the link could be placed within a mimic script loop incorporating a sleep/wait command after a refresh for x amount of seconds before looping again?
Thank you for your reply.
Tdog
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: 2020-03-12 11:27 PM
I agree with Adam, this is not what scripting is intended for.
If you want an SQL query on the page to be updated every so often, then you will need the animation property for it to change. This can be done by having the SQL animation include a meaningless point reference where that point is updated every X seconds.
The demo database has a horrible 'clock' example which has a noisy point that does something every second (I believe). So you could add that to the animation.
Something like
'SELECT stuff you care about
FROM place you care about
WHERE things you care about are true AND (' + "PointValue" ' > -1 OR TRUE)'
In this way the query is different every x seconds, but the result of the query is still the same.
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: 2020-03-13 02:03 AM
BevanWeiss
Thank you for the response - interesting idea.
Regards
Tdog
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: 2020-03-13 03:55 AM . Last Modified: 2020-03-13 03:55 AM
Many embedded lists will refresh automatically - ones which directly query database tables descending from CDBObject, such as points and RTUs. Lists such as events and historic data will not.
As an aside, if you DON'T want a query to refresh automatically there's an 'interest' checkbox on the embedded list object's properties.
Naturally, causing too regular refresh using the SQL animation method will cause extra database load, plus operator distraction as lists refresh - the trick is to find the right frequency - perhaps there is some other database item which changes, and you can JOIN using that?
The SQL animation method also requires you to take careful note of your " and ' characters, and to escape them as needed. This can get tricky when editing in the animation box, so using Notepad and cutting/pasting may help you.
The ' is used for string literals in animations and also for the SQL, so double-up single quotes for SQL within the single quotes.
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: 2020-03-13 04:04 AM
Thank you for the detailed response
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: 2020-03-13 08:48 AM
I had asked for something similar quite a while back. Probably buried somewhere in the old forums. Mine was slightly more complicated due to have multiple embedded lists on the mimic I wanted to all refresh at the same time automatically. I was able to create a button on the Mimic that would refresh all of the embedded lists, that uses a small bit of script in the background.
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: 2020-03-13 10:24 AM
Hi Tdog,
I got this to work with Animations on the embedded list. On the "SQL" property use a IIF( "~Global.List Update Trigger" > 0, 'SELECT * FROM CDBPoint, '' ) Then just toggle that Update Trigger with a Logic Program using the normal timer properties of the logic program.
-Brandon
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: 2020-03-16 04:51 AM
Thank you very much for taking time and effort to respond.
I will look into this
Tdog
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.