Page 1 of 1

How Can I refresh Databaseviewer automatically ?

Posted: Tue Jun 12, 2012 6:01 am
by memethemyn
Hi..

In my Pump Test System Project I have to refresh databaseviewer automaticaly each 500 or 1000 miliseconds. How can I do this?

Thanks Already..

Re: How Can I refresh Databaseviewer automatically ?

Posted: Tue Jun 12, 2012 8:37 am
by mark.monroe
You need to rerun the query every few seconds. First create a periodic timer, and then run the SendSelectQuery function. The timer should only run when that particular screen is opened and stop when it is closed. Rather than creating the timer in a script module, you can create it in the screen that includes the Database Viewer component.

Code: Select all

DatabaseViewer1.SendSelectQuery("Select * from DataLogger1", "Database.sdf");

Re: How Can I refresh Databaseviewer automatically ?

Posted: Wed Jun 13, 2012 1:26 am
by memethemyn
Mr. Mark..

I will try timer script as you show. But I have another idea as using demo controller and C1 register to use as a periodic timer. I tell you the way I followed step by step.

First in tags page i choose the demo controller.
Then I set a variable as C0 as shown on the picture.
When I want to write script into the controller I press Ctrl+Space but DatabaseViewer1 not shown in the box :( Only DatabaseViewer Shown in the box.

Will this way be an other way to create periodic timer. Because it is simple then scripting for me :)

Thanks Already...

Re: How Can I refresh Databaseviewer automatically ?

Posted: Mon Jun 18, 2012 2:13 am
by memethemyn
any help :(

Re: How Can I refresh Databaseviewer automatically ?

Posted: Mon Jun 18, 2012 6:40 am
by mark.monroe
A component is only available on the page where it is placed. Otherwise you get into a situation where you are trying to access a component that has not been created. Since it is only created/available when that screen is open.

You could associate an AnalogNumeric box with your "timer tag" on the screen where you want to refresh the DatabaseViewer. Then uncheck the "Visible property" of that box. Now go to the script window on the screen and put your code in the "ValueChanged" event for that invisible AnalogNumeric box. When the value of the tag that is associated with the AnalogNumeric box changes, its "ValueChanged" event will fire, and your code will execute.
Snap 2012-06-18 at 07.38.58.jpg
Snap 2012-06-18 at 07.38.58.jpg (38.89 KiB) Viewed 31272 times