Value Change Scripting


i have a memory Boolean tag, in it’s tag’s value change scripting i write the logic
but if i change the tag from 0 to 1 and 1 to 0, i see there are nothing happened and output console is empty
image

but if i designer a client tag the same scripting

it will works.

then i do a test

i manually trigger the value change


still no out put in the ouput, i don’t know why?

Tag events run in the gateway. The gateway cannot print to your designer or to any client. The gateway prints to the wrapper log. Are you sure it isn’t working?

To add to what pturmel said, print() won’t print to the gateway logs in the Status > Logs webpage. For that you should use system.util.getLogger()


i have do a test one tag one in the client tag, and another in the normal tag group

both of them use the same logic

if i trigger the Client tag, test from 0-1 and 1-0 it will works
but if i trigger the normal tag test from 0-1 and 1-0 it will not work.


gateway log will popup a lot info every second, i found found anything useful to my test tag value change case.

there tag path is
[client]NT Log 4/test
[HTC_MANTIS]NTLogSystem/runScreen/test


i have try this scripting in a button then it works in the console with the ignition manual sample code
but i don’t know how to integrate they scripting into value change, can you help to give me a sample code

Click the magnifying glass on one of those errors and examine the stack trace. The visible text in the screenshot suggests you are not getting the data you think in the event.

Please cut and paste the text of the complete error here. Places lines with triple back-quotes (these: ```) above and below the pasted text to make it readable.

Screenshots are not optimal.

We know that your logic is identical for both client tag and gateway tag. Client context and gateway context have substantial differences–some stuff simply isn’t available without a GUI, and the gateway doesn’t have one. Many people struggle with assumptions about what they think should work in the gateway, without looking at the documented differences.

Dear Sir
as you mentioned , tag events run in the gateway


then i check the gateway scripting manual , copy and paste the same logic ,it works perfect, i think , if i put all the tag change scripting in the gateway it will be easy for me to manager the project in the future

thanks a lot

You have errors in your gateway log that say what your problem is. Examine those errors’ details to figure out your problem

Clearly, due to the errors you are receiving, it does not work perfect.

image
DEAR pturmel
i check the log document, i found that tag, and found one tag expression issue make there are a lot of pop up infomation.

the expression logic is
toStr(addHours(toDate({[.]EndDateAndTime}),-8))


due to the blue line highlighted opc-tag is power off, so that make the expression tag(red line highlighted) popup a lot of warning, so , do you have suggestion , how to optimize the tag expression.

Consider nesting the try() expression function (or the coalesce() function) in that expression to substitute a valid date when the source is not valid.