Yea, sure. All you need is the client or designer context.
However, the way that you get the context in Python scripting is a bit hacky and unsupported. That’s why I just made a feature request to provide supported functions for getting the client/designer/gateway context: inductiveautomation.com/forum/vi … 71&t=11563
Here’s how you can get a client or designer context so you can get the default database name and polling rate etc. in Python. (yay Python!!!).
Throw this in an event handler somewhere:
def getContext(event):
import system
comp = event.source
if system.util.getSystemFlags() & system.util.DESIGNER_FLAG:
from com.inductiveautomation.ignition.designer import IgnitionDesigner
while not isinstance(comp,IgnitionDesigner):
comp = comp.parent
context = comp.getContext()
else:
from com.inductiveautomation.factorypmi.application.runtime import ClientPanel
while not isinstance(comp,ClientPanel):
comp = comp.parent
context = comp.getClientContext()
return context
context = getContext(event)
defaultDatasourceName = context.getDefaultDatasourceName()
pollRate = context.getTagPollRate()
print defaultDatasourceName, pollRate
By the way I look forward to meeting you at the next Ignition conference.
Nick