Client Event Script Tag Write

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.

1 Like

Try a capital ‘C’ in [Client].

This doesn’t seem to make any difference…

Run Async?

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

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

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

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)

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.

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.

I ended up using a Memory Tag to store the date info. Works well.