Action to return value

Started by borislavl, January 27, 2010, 10:35:21 PM

Previous topic - Next topic

borislavl

Hi Victor,

Thanks for the effort for creating such functionality as DCI object – errorCount.
I do appreciate that it is really professional to not make significant changes to the code without the proper testing after that.
Is it possible the DCI object to have – errorFlag which can be 1 or 0, if the last polled DCI Is error, and the next poll is successful the errorFlag to be set back to 0?
This way the DCI value can be trusted or no from the NXSL.

Thank you,
Boris

Victor Kirhenshtein

Hi!

In NXSL, you can use any integer value as boolean, where 0 means false and any-non-zero value means true. So, you can use errorCount attribute as boolean flag if you wish, like below:

if (dci->errorCount)
{
    // Processing if error
}
else
{
   // Processing if OK
}

You can also apply boolean logic operations to integer values, for example:

if (!dci->errorCount)
{
   // Processing if there are no errors
}


Best regards,
Victor