# Want to combine two datasets

**URL:** <https://forum.inductiveautomation.com/t/want-to-combine-two-datasets/103374>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [March 7, 2025, 9:56am UTC](https://forum.inductiveautomation.com/t/want-to-combine-two-datasets/103374 "2025-03-07T09:56:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [March 7, 2025, 9:56am UTC](https://forum.inductiveautomation.com/t/want-to-combine-two-datasets/103374/1 "2025-03-07T09:56:03Z")

</div>

Hi Team,

I am using tree structure in ignition vision.  
Exporting the tree structure data in json format and importing that data to other server.  
While importing json file, there is already some data present in treestructure and I want to merge json data with treestucture data.  
I have converted json file to dataset and by using appenDataset() i am trying to append it.  
It is appending the data but it is getting mismatched like below(Atest is existing and I importing BTest).

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

because of this treestructure not displaying data correctly

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/5/25bf4acefb33920df0ea610f09e54310d79e07dc.png)  
What am I doing wrong here?  
Any idea?

---

<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:** [March 7, 2025, 11:50am UTC](https://forum.inductiveautomation.com/t/want-to-combine-two-datasets/103374/2 "2025-03-07T11:50:46Z")

</div>

Without seeing the two datasets, it's going to be hard to tell. 😉

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [March 7, 2025, 2:37pm UTC](https://forum.inductiveautomation.com/t/want-to-combine-two-datasets/103374/3 "2025-03-07T14:37:55Z")

</div>

I just created onedataset property on rootcontainer and assigned the imported treedata there.  
it showing like this, here columns data getting mismatched.  
I think column order is not same for these two database.  
how can I do this with proper column order as per existing dataset?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/a/da33eba439486269e62731ab045ff58762e89e11.png)

---

<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:** [March 7, 2025, 2:59pm UTC](https://forum.inductiveautomation.com/t/want-to-combine-two-datasets/103374/4 "2025-03-07T14:59:00Z")

</div>

Your headers are not in the same order as the default dataset. _appendDataset()_ assumes the column order is the same.

In that instance, you need to specify the order. Something like this may help:

```python
d1 = system.dataset.toPyDataSet(path.to.treeView.dataset)
d2 = system.dataset.toPyDataSet(path.to.imported.dataset)

headers = list(d1.getColumnNames)
data = [list(row) for row in d1]

for row in d2:
	data.append([row[col] for col in headers])

dsOut = system.dataset.toDataSet(headers, data)

```

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [March 7, 2025, 4:12pm UTC](https://forum.inductiveautomation.com/t/want-to-combine-two-datasets/103374/5 "2025-03-07T16:12:35Z")

</div>

it worked, Thank you!
