Reviving this thread because of changes that landed in the latest nightly build/8.1.10:
The gist: In addition to isGood
, we've added new expression functions to test each different level (isBad
, isUncertain
, isError
).
As a further mechanism to allow direct comparison, e.g. if you want to find out if something is disabled, you can use the new qualityOf
expression; this will return the QualityCode object from the input. The equality operator has been 'overloaded' for QualityCodes in expressions, so you can directly compare against the (modern) string constants or integer values:
qualityOf({tag}) = 515
or
qualityOf({tag}) = "Bad_Disabled"
Note that any value outside of the 'reserved' 0-1024 range for IA codes will need to be the somewhat opaque 32-bit integer code. It's a mask on the most-significant 2 bits of a 32 bit value (representing the level; Good(0b00), Uncertain(0b01), Bad(0b10), Error(0b11)
) and the 'user code', which can be any other integer value. This is unlikely to matter to anyone unless they're using a module that implements their own custom QualityCodes.
Scripting is not affected by these changes, so the getCode()
mechanism above detailed higher in the thread is still the 'best' way to store modern codes into a database.