Alarming Timezone

I have a project that displays and alerts on data originating from an mssql database. The data is asset based and sourced from all over the world. The main screen is setup based on asset type and can handle multiple assets from multiple sites at a time, displayed via a tree view. As I select items in the treeview it filters certain screen components etc.

The alarming is setup with associated data so I can filter by site and asset and that is all good. History is handled outside Ignition, for the moment. I have a db table with timezone detail and I have sites and in turn assets configured with full knowledge of relevant timezones. The data received in the db provides for utc and site time, again I need no immediate conversion and if I do I have all timezone info available.

What I need to do is display configured alarms for all assets in a common alarms status table but display each alarm in site time, i.e. the relevant timezone.

Here is what I have looked at:

  1. I have trolled through the forums and can find little on this. I may have had a boy look, not saying I read everything but there doesn’t seem to be much call for this mixed timezone stuff.

  2. Client timezone
    Yes, changing the client timezone works but on any screen I have multiple site/timezones so this is no good.

  3. Changing timezone dynamically
    You cannot write to a system tag so I cannot change the client timezone as I iterate through the treeview.

  4. Reading data from alarmstatus table and modifying.
    No go here, I couldn’t work out when or where to get it from. I am happy to do this if its an option but I don’t know what event will give me the data as it is on the screen. Note, my filterAlarm script is working well, is this the place to do it?

  5. Adding a custom column to the alarm status table.
    No go, cannot do that.

Here is what I was thinking of doing.
Creating my own alarm status table template that has two extra columns, one for site time and anther for site name.
When a user is managing multiple sites with different timezones, functionality will hide the ‘Active Time’ column and show the ‘Site Name’ and ‘Site Active Time’ columns as well as changing the sorting to take into account the site name.

Here are my questions… finally
Is this the right approach ? Is there a better way to do this?
If I use my approach can I put an alarm status table on the page, hide it and somehow get the dataset from that do I don’t have to requery the database ?
When do I get the data from either the alarm status data or the alarm table, is there an event I can use to say get it now or do I just poll the database ?

If anyone could offer some advice here it would be very appreciated.


Just in case this helps anyone else:

My problem was solved by IA support staff. They provided me the clue with the Java TimeZone.setDefault() function. My application has a treeview with different sites in different timezones so I put the call to this in the routine controlling the treeview, changing the timezone as I navigated through the tree.

The alarm status table was then showing the appropriate records in the correct timezone. Note, I had to filter the alarm status table based on the site so I was only showing alarms from the same timezone.

This had a number of unexpected effects, none of which caused an issue. I had written a number of small script procedures to manipulate datetimes into different timezones, these largely became redundant because the times displayed on the screen are all automatically converted when the client timezone is set. Great, less code.

All worked out well thanks to Kevin and Vivian.