# Merging 2 different datasets

**URL:** <https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597>\
**Category:** Ignition\
**Tags:** database\
**Created:** [April 9, 2024, 6:43pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597 "2024-04-09T18:43:31Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lowie\_Vanhaesbrouck](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lowie\_Vanhaesbrouck](https://forum.inductiveautomation.com/u/Lowie_Vanhaesbrouck)\
**Post date:** [April 9, 2024, 6:43pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/1 "2024-04-09T18:43:32Z")

</div>

Hello , I have 2 different datasets (normally same amount of rows but not now)  
But I don't know how to merge them , couldn't find it online to do it for my specific case. You can see how I tried to do it , and how the object looks with the datasets in it. You can see how they look in the pictures , I want the end to be a dataset with the "valeur" at the end/ last column and the tag (name) next to it.

Extra : I could let the script check for the amount of rows in the first dataset to add an amount of empty rows in the second to make it fit.

Dataset1 :

```auto
"#NAMES"
"id","type","numero"
"#TYPES"
"I","str","str"
"#ROWS","7"
"501","Calories","78748290"
"502","Calories","80447923"
"503","ECS","10775395"
"504","Calories","94763"
"505","EFS","5774609"
"506","EFS","5774611"
"507","EFS","5774610"

```

dataset2:

```auto
"#NAMES"
"Tag","Valeur"
"#TYPES"
"str","D"
"#ROWS","6"
"ME-ENER-primaire","0.0"
"ME-DEBI","0.0"
"ME-ENER-primaire1","0.0"
"TestCompteurTag","2700000.0"
"ME-TEMP-depart","2.8693008422851562"
"ME-ENER","0.0"

```

 ![Schermafbeelding 2024-04-09 204811](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/2/62b50676982a78ef70e0747ee1f409b2ff1ec650.png)  
 ![Schermafbeelding 2024-04-09 204757](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/f/8fc04f1c15f233b4ee53e829ba6fb67e875e3d8d.png)  
 ![Schermafbeelding 2024-04-09 204239](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/a/eac2e9cf010a2542f30df34bead42f16c8b12119.png)

---

<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:** [April 9, 2024, 6:45pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/2 "2024-04-09T18:45:03Z")

</div>

You need to explain what’s in these datasets, whether or not they have the same column type, and what you expect the resulting merged dataset to look like.

---

<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:** [April 9, 2024, 6:46pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/3 "2024-04-09T18:46:16Z")

</div>

You can't possibly have met the requirements for [system.dataset.appendDataset()](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-dataset/system-dataset-appendDataset) -- you have different numbers of columns.

---

<div class="post-metadata">

**Author:** ![Lowie\_Vanhaesbrouck](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lowie\_Vanhaesbrouck](https://forum.inductiveautomation.com/u/Lowie_Vanhaesbrouck)\
**Post date:** [April 9, 2024, 6:50pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/4 "2024-04-09T18:50:47Z")

</div>

I know this , but it tells me it doesn't find the datasets , I know that I need the same rows and other requirements.

---

<div class="post-metadata">

**Author:** ![Lowie\_Vanhaesbrouck](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lowie\_Vanhaesbrouck](https://forum.inductiveautomation.com/u/Lowie_Vanhaesbrouck)\
**Post date:** [April 9, 2024, 6:50pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/5 "2024-04-09T18:50:54Z")

</div>

Alright done , thanks

---

<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:** [April 9, 2024, 6:52pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/6 "2024-04-09T18:52:40Z")

</div>

Perhaps you could share your input datasets in clipboard form. (Open each dataset in the Ignition dataset editor, and copy to clipboard. Paste that CSV text here, using the "Preformatted text" editor button to make it look neat.)

---

<div class="post-metadata">

**Author:** ![Lowie\_Vanhaesbrouck](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lowie\_Vanhaesbrouck](https://forum.inductiveautomation.com/u/Lowie_Vanhaesbrouck)\
**Post date:** [April 9, 2024, 6:55pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/7 "2024-04-09T18:55:00Z")

</div>

Alright , done

---

<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:** [April 9, 2024, 6:57pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/8 "2024-04-09T18:57:04Z")

</div>

Those make me think you want to **join** the two, but there's no common column to use as a key. How are the rows to be aligned?

---

<div class="post-metadata">

**Author:** ![Lowie\_Vanhaesbrouck](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lowie\_Vanhaesbrouck](https://forum.inductiveautomation.com/u/Lowie_Vanhaesbrouck)\
**Post date:** [April 9, 2024, 7:00pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/9 "2024-04-09T19:00:51Z")

</div>

Wait it would help to have a common column , it would fit perfectly then and in the right order. But right now I can't do this . This is just test tags , other scripts don't find the full aamount of tags yet . Normally it will be correct and the same amount of rows , so it would align right? If the order is correct which is also somthing I need to figure out. Right now I would just like them to be next to each other

---

<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:** [April 9, 2024, 7:02pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/10 "2024-04-09T19:02:42Z")

</div>

They're completely independent? Any number of rows and columns possible?

---

<div class="post-metadata">

**Author:** ![Lowie\_Vanhaesbrouck](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lowie\_Vanhaesbrouck](https://forum.inductiveautomation.com/u/Lowie_Vanhaesbrouck)\
**Post date:** [April 9, 2024, 7:04pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/11 "2024-04-09T19:04:43Z")

</div>

No the rows will always be the same and the column amounts aswell (they will change, but they will be the same , and the column amount wil never change. I want to make a table with the all the data inside. But to get 1 dataset I had to do alot of scripting and to get the other one also. So now I have 2 datasets that have to be next to eachother/1 big dataset so it can fill the table up

---

<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:** [April 9, 2024, 7:07pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/12 "2024-04-09T19:07:14Z")

</div>

It seems to me they don't belong in the same table. But if one must, I recommend using the [DatasetBuilder](https://forum.inductiveautomation.com/search?q=DatasetBuilder%20order%3Alatest) tool to construct the combined dataset. Where one table is longer than the other, supply nulls for the missing values.

---

<div class="post-metadata">

**Author:** ![Lowie\_Vanhaesbrouck](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lowie\_Vanhaesbrouck](https://forum.inductiveautomation.com/u/Lowie_Vanhaesbrouck)\
**Post date:** [April 9, 2024, 7:10pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/13 "2024-04-09T19:10:43Z")

</div>

So it's not possible with the append if they are the same lenghts? Would it work if I made a common column in it (not manually)

---

<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:** [April 9, 2024, 7:27pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/14 "2024-04-09T19:27:35Z")

</div>

That `.appendDataset()` function adds **rows** , not columns. There are other functions for various possibilities. But to add rows, you need a matching number (and types) of columns. And to add columns, you need a matching number of rows.

---

<div class="post-metadata">

**Author:** ![Lowie\_Vanhaesbrouck](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lowie\_Vanhaesbrouck](https://forum.inductiveautomation.com/u/Lowie_Vanhaesbrouck)\
**Post date:** [April 9, 2024, 10:40pm UTC](https://forum.inductiveautomation.com/t/merging-2-different-datasets/88597/15 "2024-04-09T22:40:05Z")

</div>

Ah alright , I only want to add column so I will just use the other function i guess. My rows will match
