Perspective binding Ignition tag quality using Mapping Transform always displays Fallback value

Hi

I’ve got an Ignition 8.1.42 Perspective Runtime View with an Icon that I would like to dynamically assign an icon path and color based on the quality of an Ignition tag (not the tag’s value).

See below my direct binding and map transformation (type:value”) settings - I think my syntax or value is incorrect, and not sure why?

I’ve also tried type:”numeric range” mapping according to the quality code (Quality Codes and Overlays | Ignition User Manual) but I think I’m referring to the wrong tag element, since the Quality element is a string, not a numerical value. Screenshot of the results of this testing are below too.

Can someone please tell me what I am doing wrong?

I’ve successfully transform-mapped tag values to icon path and color fine based on the String value of a tag - is it because I can’t use the “Quality” string the same way? If so, why not?

The tag in question is an Ignition OPC UA Boolean tied to an external Modbus TCP Server coil.
Its live value and tag quality update correctly in the Tag Browser and in the Binding Preview when I sever the server’s connection.

tag.Quality returns a QualityCode object. In the tag browser this evaluates to the string values you see, but in the binding, it is still a QualityCode.

If you add an Expression transform prior to the Map transform with the expression isGood({value}) it will evaluate the QualityCode and return a true if the code is good, and false if it is not. You can then map the boolean values to your colour as needed.

Edit: Its also possible to just use the toString({value}) in the expression and map to the converted strings.

The map transform compares the value against the result of the rows of the map transform. Since the map conditions are comparing a String/Int to a QualityCode object it always evaluates to the fallback.

If you want to use a map transform then you can either add an expression transform after the tag binding and doing toInt({value}) followed by your map transform as you have done.

Alternatively, if you dont have dynamic tag paths you could do all of this using an expression binding.

Thanks to you both David_Stone and Sanganak_Kasare, this led me in the right direction!

For anyone interested, I opted to positively assign a colour and symbol for each possible QualityCode that was listed, and discovered a few extra things:

  • toString({value}) “sometimes” gives you a string value that is verbose - e.g. toString({value}) can return “Bad(“Bad_NotConnected: The variable should receive its value from another variable”)”, and not simply “Bad_NotConnected“
  • This realised led me to map (using a Case expression as Sanganak_Kasare suggested) to the value as an integer. But then I discovered QualityCode doesn’t immediately read in as positive integers between 0-1023; instead the value appears to be read in as a 10-bit signed integer, and so codes 512-1023 are actually {value}-2^10.

The code I ended up with is (example below is for the icon path):

case({value},

// Good Quality subcodes
0, "material/done",	//	Good_Unspecified	->	Tick symbol
2, "material/done",	//	Good_WritePending	->	Tick symbol
192, "material/done",	//	Good	->	Tick symbol
200, "material/done",	//	Good_Provisional	->	Tick symbol
201, "material/done",	//	Good_Initial	->	Tick symbol
202, "material/done",	//	Good_Overload	->	Tick symbol
203, "material/done",	//	Good_Backfill	->	Tick symbol

// Bad Quality subcodes
-2147483136, "material/error",	//	Bad	->	Exclamation symbol
-2147483135, "material/error",	//	Bad_Unauthorized	->	Exclamation symbol
-2147483134, "material/error",	//	Bad_AccessDenied	->	Exclamation symbol
-2147483133, "material/error",	//	Bad_Disabled	->	Exclamation symbol
-2147483132, "material/error",	//	Bad_Stale	->	Exclamation symbol
-2147483131, "material/error",	//	Bad_TrialExpired	->	Exclamation symbol
-2147483130, "material/error",	//	Bad_LicenseExceeded	->	Exclamation symbol
-2147483129, "material/error",	//	Bad_NotFound	->	Exclamation symbol
-2147483128, "material/error",	//	Bad_ReferenceNotFound	->	Exclamation symbol
-2147483127, "material/error",	//	Bad_AggregateNotFound	->	Exclamation symbol
-2147483126, "material/error",	//	Bad_NotConnected	->	Exclamation symbol
-2147483125, "material/error",	//	Bad_GatewayCommOff	->	Exclamation symbol
-2147483124, "material/error",	//	Bad_OutofRange	->	Exclamation symbol
-2147483123, "material/error",	//	Bad_DatabaseNotConnected	->	Exclamation symbol
-2147483122, "material/error",	//	Bad_ReadOnly	->	Exclamation symbol
-2147483121, "material/error",	//	Bad_Failure	->	Exclamation symbol
-2147483120, "material/error",	//	Bad_Unsupported	->	Exclamation symbol

// Uncertain Quality subcodes
256, "material/indeterminate_check_box",	//	Uncertain	->	Dash in Square symbol
257, "material/indeterminate_check_box",	//	Uncertain_LastKnownValue	->	Dash in Square symbol
258, "material/indeterminate_check_box",	//	Uncertain_InitialValue	->	Dash in Square symbol
259, "material/indeterminate_check_box",	//	Uncertain_DataSubNormal	->	Dash in Square symbol
260, "material/indeterminate_check_box",	//	Uncertain_EngineeringUnitsExceeded	->	Dash in Square symbol
261, "material/indeterminate_check_box",	//	Uncertain_IncompleteOperation	->	Dash in Square symbol

// Error Quality subcodes
-2147482880, "material/indeterminate_check_box",	//	Error	->	Dash in Square symbol
-2147482879, "material/indeterminate_check_box",	//	Error_Configuration	->	Dash in Square symbol
-2147482878, "material/indeterminate_check_box",	//	Error_ExpressionEval	->	Dash in Square symbol
-2147482877, "material/indeterminate_check_box",	//	Error_TagExecution	->	Dash in Square symbol
-2147482876, "material/indeterminate_check_box",	//	Error_TypeConversion	->	Dash in Square symbol
-2147482875, "material/indeterminate_check_box",	//	Error_DatabaseQuery	->	Dash in Square symbol
-2147482874, "material/indeterminate_check_box",	//	Error_IO	->	Dash in Square symbol
-2147482873, "material/indeterminate_check_box",	//	Error_TimeoutExpired	->	Dash in Square symbol
-2147482872, "material/indeterminate_check_box",	//	Error_Exception	->	Dash in Square symbol
-2147482871, "material/indeterminate_check_box",	//	Error_InvalidPathSyntax	->	Dash in Square symbol
-2147482870, "material/indeterminate_check_box",	//	Error_Formatting	->	Dash in Square symbol
-2147482869, "material/indeterminate_check_box",	//	Error_ScriptEval	->	Dash in Square symbol
-2147482868, "material/indeterminate_check_box",	//	Error_CycleDetected	->	Dash in Square symbol

"material/indeterminate_check_box")		//	Fallback	->	Dash in Square symbol
1 Like