Get/bind tag historical deadband style

I’m setting up a tag configuration page, and I have successfully built something where a user can identify a data point, bring up a configuration window, enable/disable tag history, and select a historical data provider from a session. The last piece of the puzzle I’d like to bring in is the ability to set the historical deadband style. It doesn’t appear that this tag property is exposed anywhere for me to use - is there any way of binding a dropdown to this property somehow, without having to attach a script to every single tag?

You can use system.tag.getConfiguration to get the current historical deadband style:

path = '[default]New Tag4'
config = system.tag.getConfiguration(path, False)
print config[0]['historicalDeadbandStyle']

Then system.tag.configure to set the deadband style to what you want. Hopefully i got the idea on what you are trying to do and this helps.

Yes, that was exactly it. Thanks a lot!

1 Like

Just a small caveat: system.tag.getConfiguration only returns values that are not at the default value. So if the deadband style is Auto, it will not be returned by system.tag.getConfiguration.

What I ended up doing was creating a history configuration popup with three custom methods: getDefaults, getTagConfig and setTagConfig.

getDefaults just returns a manually-generated dictionary of all tag history related parameters, and their default values. So now I have a complete structure of tag history related parameters.

getConfiguration gets the existing tag configuration and then compares it to the default configuration. It then builds a complete configuration by combining the non-default values returned by
system.tag.getConfiguration and the default values returned by getDefaults, and puts this information into various fields on the popup.

setConfiguration then reads the information out of the fields on the popup and creates an updated configuration dictionary. It also re-reads the existing tag configuration and the default configuration, to ensure that it only updates values that are being changed from what they currently are. Finally, it writes that updated configuration back to the tag using system.tag.configure

A note to developers on this front: it wasn’t exactly straightforward to find all of the tag parameters, since system.tag.getConfiguration only returns non-default parameters. I ended up creating a tag, setting all the history parameters to non-default values, and then running system.tag.getConfiguration on that tag in the script console. Even then, it wasn’t immediately clear how each value is interpreted. For example, on the tag configuration window, you can set the minimum sample time units to milliseconds, seconds, minutes and so on - but at the back end, the parameter value is MS, SEC, MIN and so on. Some of them were even more unexpected - the deadband style in particular threw me because if you set it to Auto, the parameter value is Auto, if you set it to Discrete the parameter value is likewise Discrete, but if you set it to Analog, the parameter value is Analog_Compressed. I ended up having to select every possible combination of parameters and run system.tag.getConfiguration repeatedly to make sure I had collated all of the different parameter names and their possible values. It would be really helpful if these parameter names and values were documented somewhere! (or if they are documented somewhere and I just didn’t find it, perhaps a link could be added to the system.tag.configure and system.tag.getConfiguration manual pages?)

1 Like

Start here:

Then here:

Notice the .getDefaultValue() method for these property definitions.

1 Like

That is what the manual states, but when i tested, i was able to get a return of “Auto” I don’t know if its expected behavior or not, but it appears to only not return a value if the property was never changed from default. If you set it to something else, then back to Auto you get a result. Splitting hairs at this point i think.

I still can’t see any of these properties listed on that page - although the getDefaultValue() method is a useful one to know!

Yes, if you set a tag to a non-default and then set it back to the default, it appears to retain its “override” property, and it continues to be returned by system.tag.getConfiguration. If you remove the override entirely, it is no longer returned.

Sorry, these too.

The javadocs cross references to implementing classes are incomplete. ):

Others are scattered about, and both modules and users can define more.

1 Like

There they are! Of course, that still doesn’t give me a list of the potential values, and if I wanted to nitpick I’d suggest that they parameter names are all in TitleCase in that list, but in camelCase in ignition.

Drill into the enumeration classes where defined, the X in Property<X>. That shows the possible values. Like InterpolationMode for HistoricalDeadbandStyle.

{ Do links highlight in your browser? You can click on them to explore… /snark }

1 Like

Ah, there we go. I tried the links in the Field column, and missed the links in the type column entirely :upside_down_face:


1 Like