# \[BUG\] ? Perspective table data currentValue not equal to previousValue when data hasn't changed

**URL:** <https://forum.inductiveautomation.com/t/bug-perspective-table-data-currentvalue-not-equal-to-previousvalue-when-data-hasnt-changed/64356>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [September 22, 2022, 2:03am UTC](https://forum.inductiveautomation.com/t/bug-perspective-table-data-currentvalue-not-equal-to-previousvalue-when-data-hasnt-changed/64356 "2022-09-22T02:03:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![richardNZ15](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/richardnz15/32/33373_2.png) [@richardNZ15](https://forum.inductiveautomation.com/u/richardNZ15)\
**Post date:** [September 22, 2022, 2:03am UTC](https://forum.inductiveautomation.com/t/bug-perspective-table-data-currentvalue-not-equal-to-previousvalue-when-data-hasnt-changed/64356/1 "2022-09-22T02:03:24Z")

</div>

I have a named query which generates a dataset to a Perspective table.  
The named query uses some date parameters which are configured as custom properties on the Perspective View. Specifically endDate and startDate.  
These do not change their **.value** , but the **.timestamp** is changing constantly due to the fact they are bound to the realtime equivilants, executing a now(10000) expression.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/9/b9f449c71f0c5d95fa8f992c520f7828f4dcfc32.png)

This results in the named query being triggered every 10000ms, because the custom properties are changing their timestamps. **This is extremely annoying.** But i can see why it could be necessary.

However my problem is now that i can’t seem to detect a “REAL VALUE” change on the dataset.  
I’ve put a valueChanged script on it, and print out the currentValue and previousValue of the data, and even though i thought the .value of the dataset shouldn’t change, a simple:

```auto
if currentValue.value != previousValue.value:
   print "Something changed"

```

is **always evaluating**.

Is this a bug, or do we need to write comprehensive checks to ensure that the data in the dataset has actually changed? Such as comparing first and last values or something…

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [September 22, 2022, 3:27am UTC](https://forum.inductiveautomation.com/t/bug-perspective-table-data-currentvalue-not-equal-to-previousvalue-when-data-hasnt-changed/64356/2 "2022-09-22T03:27:03Z")

</div>

Probably just that the comparison doesn’t work exactly the way you might think when comparing two objects.

Perhaps try this:

```python
from com.inductiveautomation.ignition.common.util import DatasetTestUtils
if not DatasetTestUtils.equals(currentValue.value,previousValue.value):
    print "Something changed"

```

---

<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 22, 2022, 2:30pm UTC](https://forum.inductiveautomation.com/t/bug-perspective-table-data-currentvalue-not-equal-to-previousvalue-when-data-hasnt-changed/64356/3 "2022-09-22T14:30:57Z")

</div>

This is a case where I would use `objectScript` (from my free Simulation Aids module) in bindings for your date/time values. Its `state` dictionary can hold the prior datetime delivered and keep returning _ **IT** _ instead of the new one if they are equal. That would keep your named query from re-triggering.

---

<div class="post-metadata">

**Author:** ![richardNZ15](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/richardnz15/32/33373_2.png) [@richardNZ15](https://forum.inductiveautomation.com/u/richardNZ15)\
**Post date:** [September 22, 2022, 8:25pm UTC](https://forum.inductiveautomation.com/t/bug-perspective-table-data-currentvalue-not-equal-to-previousvalue-when-data-hasnt-changed/64356/4 "2022-09-22T20:25:26Z")

</div>

Thank you both for the suggestions, I will give those a try.  
objectScript functionality sounds great, I’d definitely rather have the binding not trigger the named query all the time, but i’ll need to run the idea of a 3rd party module through the client first.

---

<div class="post-metadata">

**Author:** ![richardNZ15](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/richardnz15/32/33373_2.png) [@richardNZ15](https://forum.inductiveautomation.com/u/richardNZ15)\
**Post date:** [September 22, 2022, 8:54pm UTC](https://forum.inductiveautomation.com/t/bug-perspective-table-data-currentvalue-not-equal-to-previousvalue-when-data-hasnt-changed/64356/5 "2022-09-22T20:54:46Z")

</div>

FYI the first "common" needs to be removed in the import:

```auto
from com.inductiveautomation.ignition.common.util import DatasetTestUtils

```

But even then it is still not working sadly..  
Seems like there are some issues with this method:

> [@DatasetTestUtils.equals not working as expected](https://forum.inductiveautomation.com/t/datasettestutils-equals-not-working-as-expected/38073):
>
> Using Ignition 7.9.9. I would expect the following to print True, however it prints False. from com.inductiveautomation.ignition.common.util import DatasetBuilder, DatasetTestUtils from java.lang import String,Double from java.util import Date emptyDS1 = DatasetBuilder.newBuilder().colNames("col1", "col2", "col3").colTypes(Double, String, Date).build() emptyDS2 = DatasetBuilder.newBuilder().colNames("col1", "col2", "col3").colTypes(Double, String, Date).build() print(DatasetTestUtils.equals(emp…

And i'm not really sure how that "method reflection" stuff works as mentioned in the thread.
