Action item

I have action Item with command

IF({StopBit}=true,{FaultRegister},0)

where StopBit and FaultRegister are OPC Items,

when StopBit and FaultRegister have good opc quality than action item shows correct value,
when StopBit have good quality and FaultRegister bad quality than action item have also bad quality, and this is correct,
but when StopBit have bad quality than action item have good quality and value = 0.

why?
is there any function to check quality of opc item?

I can’t answer your question directly but may I suggest creating parallel OPC items (e.g., {StopBitQuality}) that refer to the tags’ Quality (i.e., select “Quality” for the Property on the OPC Item Configuration dialog) and incorporate those items into your action item logic. For example:

IF({StopBit} && ({StopBitQuality}=192), {FaultRegister}, 0)

Thanks for the answer,
this is some kind of solution but it is not satisfied,
because I log Action Item to databas and wanto to log bad quality when
StopBit or FaultRegister have bad quality,

If I understand your objective, I see two options:

  1. Log {StopBitQuality} and {FaultRegisterQuality} to the database along with {StopBit} and/or {FaultRegister}.

or

  1. Change your IF statement logic to log a “special” value if either {StopBitQuality} or {FaultRegisterQuality} are not equal to 192 (192 = good quality). For example, IF({StopBitQuality}!=192 || {FaultRegisterQuality}!=192, -1, {FaultRegister})

I’m thinking that the latter is what you desire.

MickeyBob’s right, it sounds like you either need to check the quality and log a special value, or store the quality separately.

The problem is that the “Value” and the “Quality” of an item are unfortunately fairly separate in the groups. When the action item value says “bad quality”, it’s still going to log whatever the value is- which will likely be incorrect. You need to log the quality separately in order to know whether to trust the value. This is also the source of your original question: The “if” statement only looks at the value of the item, not the quality- so in your original post, the if statement executes and the value is returned according to {StopBit}'s (bad) value at the time, 0.

Hope this helps,

thanks for help, but I have another question

now I have standard group to update record in database,
in this group I have two action item,
one to log value calculated from opc items,

IF({StopBit}=true,{FaultRegister},0)

and second to log opc quality

if(ToInt({StopBit.DataIntegrity}) = 192 && ToInt({FaultRegister.DataIntegrity}) = 192,192,0)

and my question is,
are this two action item logged in one update statement,
or each action item are logged to database in separated statement,

because if each action item is updated in separated statements it may occur situation:
when opc quality is bad, than action item with value is inccorect,
and when it will be logged first before quality item,
in database we have incorrect values between this two updates,

Yes, they will both be written in the same query.

Regards,