# Client Event Script Tag Write

**URL:** <https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342>\
**Category:** Ignition\
**Created:** [September 18, 2019, 1:48pm UTC](https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342 "2019-09-18T13:48:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hachjessed](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@hachjessed](https://forum.inductiveautomation.com/u/hachjessed)\
**Post date:** [September 18, 2019, 1:48pm UTC](https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342/1 "2019-09-18T13:48:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 18, 2019, 3:00pm UTC](https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342/2 "2019-09-18T15:00:46Z")

</div>

Try a capital ‘C’ in `[Client]`.

---

<div class="post-metadata">

**Author:** ![hachjessed](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@hachjessed](https://forum.inductiveautomation.com/u/hachjessed)\
**Post date:** [September 18, 2019, 4:53pm UTC](https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342/3 "2019-09-18T16:53:44Z")

</div>

This doesn’t seem to make any difference…

---

<div class="post-metadata">

**Author:** ![jimdelillo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jimdelillo/32/10829_2.png) [@jimdelillo](https://forum.inductiveautomation.com/u/jimdelillo)\
**Post date:** [September 18, 2019, 5:12pm UTC](https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342/4 "2019-09-18T17:12:41Z")

</div>

Run Async?

[https://docs.inductiveautomation.com/display/DOC79/system.util.invokeAsynchronous](https://docs.inductiveautomation.com/display/DOC79/system.util.invokeAsynchronous)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 19, 2019, 5:42am UTC](https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342/5 "2019-09-19T05:42:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hachjessed](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@hachjessed](https://forum.inductiveautomation.com/u/hachjessed)\
**Post date:** [September 19, 2019, 2:17pm UTC](https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342/6 "2019-09-19T14:17:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [September 19, 2019, 11:40pm UTC](https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342/7 "2019-09-19T23:40:43Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![hachjessed](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@hachjessed](https://forum.inductiveautomation.com/u/hachjessed)\
**Post date:** [September 20, 2019, 5:21pm UTC](https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342/8 "2019-09-20T17:21:04Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 21, 2019, 3:11am UTC](https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342/9 "2019-09-21T03:11:58Z")

</div>

> [@hachjessed](#):
>
> So when I close the project and reopen I have an old value showing on the label.

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.

---

<div class="post-metadata">

**Author:** ![hachjessed](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@hachjessed](https://forum.inductiveautomation.com/u/hachjessed)\
**Post date:** [October 24, 2019, 6:05pm UTC](https://forum.inductiveautomation.com/t/client-event-script-tag-write/28342/10 "2019-10-24T18:05:13Z")

</div>

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