Checking quality of SQLTag in Jython

I want to check the value of a SQLTag point before writing to an output. What I planned to do was check the Quality property of the point using the fpmi.tag.getTagValue function to check the value was good, then read the point and write to the output depending on what the point value was.

However, I don’t seem to be able to read the Quality of the point. Is this possible?

Hi-

Yes, it should definitely be possible. I’m not at a machine w/FPMI right now to confirm the exact syntax, but try this: add a dynamic property for quality to a component. Then, in the SQLTags browser, find a tag, and expand it so that you can see its properties. Drag the quality down onto the dynamic property that you create. This will bind the property to the quality. You can just use that, or go in a look at how it bound it in order to do it yourself in other places.

Hope that helps,

To read a tag’s quality using scripting, you would do:

quality = fpmi.tag.getTagValue("[]Path/To/MyTag.Quality") qualityCode = quality.getIntValue() qualityDescription = quality.toString()

You would then use qualityCode or qualityDescription in your script. Note that 192 is the code for good quality.

Sorry to bump this thread, but I came across it when searching for a solution to the same problem.

I am executing the following:

		tagname = '[]T253/Tank Level.Quality'
		tagval = fpmi.tag.getTagValue(tagname)

When executing tagval.getIntValue() I get:

AttributeError: 'float' object has no attribute 'getIntValue'

When executing qualityDesc = tagval.toString() I get the numerical value of the tag ([]T253/Tank Level) in the form of a string. I am not able to obtain the actual quality code or description. Am I possibly formatting something incorrectly?

Edit: Also, when binding a dynamic property to []T253/Tank Level.Quality indrectly, I still am seeing the value of the tag, not the quality.

No, you’re absolutely right. fpmi.tag.getTagValue always returns the tags value, it ignores the actual property specified in the tagpath (contrary to the example above). We’ll fix this so that it works as you might expect, but in the meantime, you can do this:

quality = fpmi.tag.getTag("[]Path/To/MyTag").dataQuality qualityCode = quality.getIntValue() qualityDescription = quality.toString()

Sorry for the misleading post earlier.