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