# DatasetTestUtils.equals not working as expected

**URL:** <https://forum.inductiveautomation.com/t/datasettestutils-equals-not-working-as-expected/38073>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [August 25, 2020, 11:31pm UTC](https://forum.inductiveautomation.com/t/datasettestutils-equals-not-working-as-expected/38073 "2020-08-25T23:31:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fourmajor](https://avatars.discourse-cdn.com/v4/letter/f/898d66/32.png) [@fourmajor](https://forum.inductiveautomation.com/u/fourmajor)\
**Post date:** [August 25, 2020, 11:31pm UTC](https://forum.inductiveautomation.com/t/datasettestutils-equals-not-working-as-expected/38073/1 "2020-08-25T23:31:12Z")

</div>

Using Ignition 7.9.9. I would expect the following to print `True`, however it prints `False`.

```auto
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(emptyDS1, emptyDS2))

```

Only if I compare the same dataset (`DatasetTestUtils.equals(emptyDS1, emptyDS1)`) does it return `True`. Any ideas?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 25, 2020, 11:58pm UTC](https://forum.inductiveautomation.com/t/datasettestutils-equals-not-working-as-expected/38073/2 "2020-08-25T23:58:06Z")

</div>

Huh, unfortunate. Looks like a problem stemming from the fact the method is called `equals`, and some kind of Jython interop problem.

---

<div class="post-metadata">

**Author:** ![fourmajor](https://avatars.discourse-cdn.com/v4/letter/f/898d66/32.png) [@fourmajor](https://forum.inductiveautomation.com/u/fourmajor)\
**Post date:** [August 26, 2020, 12:03am UTC](https://forum.inductiveautomation.com/t/datasettestutils-equals-not-working-as-expected/38073/3 "2020-08-26T00:03:13Z")

</div>

Thanks for checking it out. In the meantime, this works well enough for my purposes, hopefully it can help someone else too:

```auto
	def datasets_equals(newValue, oldValue):
		if (newValue.getRowCount() != oldValue.getRowCount()) or (newValue.getColumnCount() != oldValue.columnCount):
			return False
		else:
			for rowIndex in range(newValue.getRowCount()):
				for colIndex in range(newValue.getColumnCount()):
					if event.newValue.getValueAt(rowIndex, colIndex) != event.oldValue.getValueAt(rowIndex, colIndex):
						return False
		return True

```

(could check for column types and possibly other stuff too, but I know my particular data doesn’t require it)

---

<div class="post-metadata">

**Author:** ![Kurt.Larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kurt.larson/32/6426_2.png) [@Kurt.Larson](https://forum.inductiveautomation.com/u/Kurt.Larson)\
**Post date:** [August 26, 2020, 12:23am UTC](https://forum.inductiveautomation.com/t/datasettestutils-equals-not-working-as-expected/38073/4 "2020-08-26T00:23:49Z")

</div>

You can use reflection to call the method:

```auto
from com.inductiveautomation.ignition.common import Dataset
method = DatasetTestUtils.getDeclaredMethod("equals", Dataset, Dataset)
method.invoke(DatasetTestUtils, emptyDS1, emptyDS2)

from org.apache.commons.lang3.reflect import MethodUtils
MethodUtils.invokeStaticMethod(DatasetTestUtils, "equals", emptyDS1, emptyDS2)

```
