Current problem: I am trying to map an integer alarm value to string reason code in AF using a table look-up attribute. I have created a table that relates these strings by SYSTEM (table) -> Asset Code (static string attribute on current element), and ORG (table) -> Organization Code (static string attribute on grandparent element).
Current lookup code:
SELECT STATUS FROM AlarmLookup WHERE VALUE = @[Alarm 1] AND SYSTEM = @[Asset Code] AND ALARMNO = 1 AND ORG = %..\..\|[Organization Code]% ORDER BY STATUS;RWN=Alarm not coded
DataTable.Select(VALUE = 0 AND SYSTEM = 'NB_Mixer' AND ALARMNO = 1 AND ORG = %..\..\|[Organization Code]%) has thrown an exception: Syntax error: Missing operand before 'Mod' operator.
This seems to work fine when I omit the ORG lookup, but this attribute is needed for future scalability.
More background - I have tried solving this mapping issue in many other ways and run into dead ends with each:
1) Apply map in Pi SMT with digital states - Alarms are direct extraction from a PLC where their programming standard is to store a single alarm into each bit of a DINT32. This results in a discontinuous digital state map with mostly empty data that is too large to manage since this system prefers appears to prefer format [0='no alarm', 1='Alarm 1', 2=null...65536='Alarm 16'...] instead of [0='no alarm', 1='Alarm 1', 65536='Alarm 16'...]
2) We are looking to compress this binary representation to a compressed integer to make this easier, but have no access to make such a change to our PLC's at the moment due to COVID restrictions.
3) I tried creating enumeration sets for each alarm set - but AF will not allow application of a different enumeration set to different assets using the same template.