# Expression evaluates differently on two different Vision clients

**URL:** <https://forum.inductiveautomation.com/t/expression-evaluates-differently-on-two-different-vision-clients/80564>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [October 17, 2023, 1:49am UTC](https://forum.inductiveautomation.com/t/expression-evaluates-differently-on-two-different-vision-clients/80564 "2023-10-17T01:49:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sherman](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@sherman](https://forum.inductiveautomation.com/u/sherman)\
**Post date:** [October 17, 2023, 1:49am UTC](https://forum.inductiveautomation.com/t/expression-evaluates-differently-on-two-different-vision-clients/80564/1 "2023-10-17T01:49:14Z")

</div>

I have an expression

` if(dateDiff(tag({svc_status.tagPath} + "/timestamp"), now(), "seconds") < 10, 0, 2)`

That I am using to set the state on an indicator. On my laptop in both designer and client, this evaluates correctly. However, on another laptop client, it does not evaluate correctly. I don't know exactly how it is not evaluating correclty, other than my client/designer evaluates to `0` and the other client seems to evaluate to `2` (based on the response from the widget, which changes color depending on the status value). Both clients are indicating the same current time, so I am not quite sure what could be misbehaving. My guess was some timezone shenanigans, which doesn't track with both clients (and operating systems) indicating the correct time.

The `{svc_status.tagPath}+"/timestamp"` tag is written to via a continually evaluated (every second) gateway script that is simply calling a Project Library script that is as follows:

```auto
def update_statuses():
	tcp2mqtt = json_decode(get_service_status("tcp2mqtt/status"))
	oscope = json_decode(get_service_status("oscope/status"))
	system.tag.writeBlocking([ 
		"[HMI]TB0/network/nasvc/tcp2mqtt/timestamp", 
		"[HMI]TB0/network/nasvc/tcp2mqtt/status", 
		"[HMI]TB0/network/nasvc/oscope/timestamp",
		"[HMI]TB0/network/nasvc/oscope/status"
		], [		
		system.date.parse(tcp2mqtt['timestamp'], "yyyy-MM-dd HH:mm:ssz"),
		tcp2mqtt['status'],
		system.date.parse(oscope['timestamp'], "yyyy-MM-dd HH:mm:ssz"),
		oscope['status']
		])

```

This is all fresh, active development code and is not in its final state.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [October 17, 2023, 6:18am UTC](https://forum.inductiveautomation.com/t/expression-evaluates-differently-on-two-different-vision-clients/80564/2 "2023-10-17T06:18:10Z")

</div>

That would indicate that the time is off between the two systems. Expression bindings, for the most part, are evaluated at the client level not the GW level. Tag expression bindings are at the Tag Level. Making this an expression tag should keep it from having a different result between two different clients.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 17, 2023, 10:26am UTC](https://forum.inductiveautomation.com/t/expression-evaluates-differently-on-two-different-vision-clients/80564/3 "2023-10-17T10:26:20Z")

</div>

Consider using expression tags to evaluate the difference. Then it will remain the same regardless of client.

```auto
if(secondsBetween([HMI]TB0/network/nasvc/tcp2mqtt/timestamp, now()) < 10, 0, 2)

```

---

<div class="post-metadata">

**Author:** ![sherman](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@sherman](https://forum.inductiveautomation.com/u/sherman)\
**Post date:** [October 17, 2023, 8:29pm UTC](https://forum.inductiveautomation.com/t/expression-evaluates-differently-on-two-different-vision-clients/80564/4 "2023-10-17T20:29:58Z")

</div>

This worked! Thank you. I should have done this from the beginning.
