Problem with system.tag.getConfiguration() doesn't return dataType

I have detected, what in my opinion is a bug, with system.tag.getConfiguration().
When I create a simple basic memory tag of Type Integer and then get its config with function above. I get this:

{u'path': [test]oil/o2, u'tagType': AtomicTag, u'name': u'o2', u'valueSource': u'memory', u'value': 50L}

Then I change its dataType to Float for example and get:

{u'dataType': Float4, u'path': [test]oil/o2, u'tagType': AtomicTag, u'name': u'o2', u'valueSource': u'memory', u'value': 50L}

Finally, I return its dataType to Integer I get:

{u'dataType': Int4, u'path': [test]oil/o2, u'tagType': AtomicTag, u'name': u'o2', u'valueSource': u'memory', u'value': 50L}

Then first attempt didn’t return the dataType, but at the end it did when I changed those configs.

Some IA Teams opinion would be appreciated.

1 Like

Int4 is the default data type, and therefore not part of the stored configuration (until explicitly set), as it is assumed by the rest of the system.
This is a longstanding, annoying problem that we’d like to fix, but it is tricky to do.
What might happen is an alternate scripting function or a way to opt your call in to retrieving all details.

4 Likes

Oh ok, it has sense I think.
Isn’t it possible to set the default type to null instead of Int4? just wondering.

For now, I’ll add couple conditions in the script and ask first if the tag exists and it has no dataType then it’s a Int4 Type

You can get the default alarm props with this
Should be able to do something similar to get all default tag config as well if you wanted to.
I tried, but failed. Will post where I got to when back at my laptop, but hopefully one of the nice IA guys will be able to help :grinning_face_with_smiling_eyes:

Ok, after some help, you can get the default value from com.inductiveautomation.ignition.common.tags.config.properties.WellKnownTagProps

e.g.

from com.inductiveautomation.ignition.common.tags.config.properties import WellKnownTagProps

propObj = WellKnownTagProps.DataType
print propObj.defaultValue
print propObj.name
print propObj.type

>>>>
Int4
dataType
<type 'com.inductiveautomation.ignition.common.sqltags.model.types.DataType'>
1 Like