Historical Tag Path in Ignition SDK

I’m trying to write a historical query from a component in a module I’m developing. I’m using the standard gateway interface “runTagHistoryQuery” function. It’s all working very well, except I have to set it up with a fully qualified tag path in the client (histprov:historian:/drv:ignition-cody-pc:default:/tag:tags/ramp/ramp0). Obviously I think this is far from intuitive for someone to use so I’d like to whittle my tag path down to one or all of the following:

  1. tags/ramp/ramp0
  2. [~]tags/ramp/ramp0
  3. [historian/ignition-cody-pc:default]tags/ramp/ramp0

Now my question is, how do I take a less than fully qualified tag path from the client and turn it into the a fully qualified historical tag path. I can retrieve the default data source and default tag provider from the client context with:

    ClientContext context = getAppContext();
    defaultDatasource = context.getDefaultDatasourceName();
    defaultTagProvider = context.getDefaultSQLTagsProviderName();

But I’m missing the system name. So I guess my question is

  1. What java Class would I use to get the system name?
  2. Am I even approaching this the right way or is there already a class to do this? (I’ve found classes to parse SQL tag paths but not historical).


Ok so with the help of Kyle Chase I’ve retrieved the system name via an RPC call to query the gateway’s internal database.

    PersistenceInterface gwDBInterface = context.getPersistenceInterface();
    PersistentRecord systemRecord = gwDBInterface.find(SystemPropertiesRecord.META, 0);

    return systemRecord.getString(SystemPropertiesRecord.SystemName);

Now I still have to wonder, isn’t there an easier/better way?