Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

Close
Important Announcement: WELCOME to the new Schneider Electric Community! Community is now no longer part of Exchange, and is now rebranded under se.com. If you have any bookmarks and links saved, we request you to update them to ensure that you continue accessing our community from this new location. For any issues that you might encounter as part of this change, please reach out to SchneiderCommunity.Support@se.com, and the team will help to get your issues resolved.
Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
82537members
350142posts

Automatically Refresh Embedded Mimic Query List using Script

EcoStruxure Geo SCADA Expert Forum

Find out how SCADA systems and networks, like EcoStruxure Geo SCADA Expert, help industrial organizations maintaining efficiency, processing data for smarter decision making with IoT, RTU and PLC devices.

Solved
Tdog
Crewman
Crewman
0 Likes
9
2427

Automatically Refresh Embedded Mimic Query List using Script

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


Accepted Solutions
BevanWeiss
Spock
Spock
0 Likes
3
2406

Re: Automatically Refresh Embedded Mimic Query List using Script

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.


Lead Control Systems Engineer for Alliance Automation (VIC).
All opinions are my own and do not represent the opinions or policies of my employer, or of my cat..

See Answer In Context

9 Replies 9
AdamWoodland
Commander Commander
Commander
0 Likes
7
2424

Re: Automatically Refresh Embedded Mimic Query List using Script

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.

 

 

Tdog
Crewman
Crewman
6
2421

Re: Automatically Refresh Embedded Mimic Query List using Script

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

BevanWeiss
Spock
Spock
0 Likes
3
2407

Re: Automatically Refresh Embedded Mimic Query List using Script

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.


Lead Control Systems Engineer for Alliance Automation (VIC).
All opinions are my own and do not represent the opinions or policies of my employer, or of my cat..
Tdog
Crewman
Crewman
0 Likes
2
2402

Re: Automatically Refresh Embedded Mimic Query List using Script

BevanWeiss

 

Thank you for the response - interesting idea.

 

Regards

 

Tdog

sbeadle
Janeway Janeway
Janeway
0 Likes
1
2396

Re: Automatically Refresh Embedded Mimic Query List using Script

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.

Tdog
Crewman
Crewman
0 Likes
0
2393

Re: Automatically Refresh Embedded Mimic Query List using Script

Thank you for the detailed response

Hardin4019
Lieutenant
Lieutenant
0 Likes
1
2386

Re: Automatically Refresh Embedded Mimic Query List using Script

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. 

bamador
Crewman
Crewman
0 Likes
0
2384

Re: Automatically Refresh Embedded Mimic Query List using Script

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

Tdog
Crewman
Crewman
0 Likes
0
2351

Re: Automatically Refresh Embedded Mimic Query List using Script

Thank you very much for taking time and effort to respond.

 

I will look into this

 

Tdog