Clicking on Events table n Axiom to open a display for the selected event
I'm trying and failing to do this using scripting in Axiom but maybe there's another way to do what I want (I'm running Canary V25.1)?
What I wanted was, within Axiom, to configure it so that when an event was clicked in an event table, it would open a screen showing the affected asset over the time of the event. Something like this pseudocode:
EventsTable1.OnEventClick(sender, eventInstance)
{
if (eventInstance.Type == "Solar String Down Event")
{
OpenDisplay("Solar String Display", EventInstance.Source, EventInstance.StartTime, EventInstance.EndTime);
}
}
But I find that the eventInstance object contains a constructor but nothing else so I can't access its type, source or start and end times. Likewise the sender object is the events grid but gives no way to find the details of the highlighted event. So I cannot get any of the details I need to pass to my OpenDisplay() function. I'm also assuming that such a function exists or can be written!
Is there any way, with or without scripting, do do what I want?
1 reply
-
If you want to open another asset based screen that contains a TrendGraph, using the Event Table, you can use something like the following code:
public void EventsTable1_OnEventClick(object sender, PropertyEventInstance eventInstance) { Log.Info(eventInstance.AssetBasePath); var pathParts = eventInstance.AssetBasePath.Split('.'); var assetView = pathParts[0]; var assetPath = String.Join(".", pathParts.Skip(1).ToArray()); //Replace "AssetTypeName" with the actual asset type for the event Screen2.AssetInstance = new PropertyAssetInstance("localhost",assetView,assetPath,"AssetTypeName"); Application.CurrentScreen = Screen2; var trendGraph = (ControlTrendGraph)Screen2.ScreenControls["TrendGraph1"]; trendGraph.TimeEnd = eventInstance.TimeEnd; trendGraph.TimeDuration = eventInstance.TimeEnd - eventInstance.TimeStart; }