Is there a way to find the default DB for a project, from a gateway script?
I can use the system.db.getConnectionsInfo() to get the default DB of the project from a client level.
However I see the getConnectionInfo() needs a argument in a gateway script.
I’m after a way to do this without having to change my gateway script every time I start a new project
Hi Cam,
Yes, but it requires installing the Power Scripting Module, which has other useful things as well.
This code will get you the default datasource in any project gateway script:from com.inductiveautomation.ignition.common.project import ProjectVersion
context = pa.ignition.getContext()
manager = context.getProjectManager()
projectID = manager.getProjectId(system.util.getProjectName())
props = manager.getProps(projectID, ProjectVersion.Published)
defaultDatasource = props.getDefaultDatasourceName()Best,