Client Event Script Tag Write

#1

I am attempting to write to a tag from a Client Event Script(Menu Bar), and for some reason it appears to write the value momentarily but does not save the value to the tag. I have a display component that is bound to the tag which does update when the Client Event Script runs but the tag value never shows the updated value. Any ideas why this value is not saving to the tag when the Client Event Script is ran?

	date = system.date.now()
	system.tag.write('[client]NCCA/Update Time.Value', date)

I added this script to a button component and it operates correctly. Any ideas would be appreciated.

0 Likes

#2

Try a capital ‘C’ in [Client].

0 Likes

#3

This doesn’t seem to make any difference…

0 Likes

#4

Run Async?

https://docs.inductiveautomation.com/display/DOC79/system.util.invokeAsynchronous

0 Likes

#5

Examine the return value from system.tag.write().

0 Likes

#6

Can I run a Client Event through Designer, to test output of a script?

0 Likes

#7

You have it pointing to the tag"[client]NCCA/Update Time.Value" should it not be "[client]NCCA/Update Time" ?

I don’t know if you have a UDT or something, but typically the .value is used when reading the tag (at least that’s how I have mine)

0 Likes

#8

pturmel -
If I run the below script on a button component it returns a value of 2.

path = '[Client]NCCA/Update Time'
date = system.date.now()
print system.tag.write(path, date)

Does that sound correct?

Ryan.White -
I have tried it with the .Value and w/o. Same outcome. It has to be writing to the tag for a moment, because I have label component with an expression binding to the tag and it will update with the new time value, but the tag never shows the updated value. So when I close the project and reopen I have an old value showing on the label. It appears there is a disconnect between in the Client Event script, as if I put this script in a button component, the tag will update.

0 Likes

#9

You cannot change the initial value of a client tag at runtime. That value is the last value present when the project is saved in the designer.

0 Likes