# Concat two datasets

**URL:** <https://forum.inductiveautomation.com/t/concat-two-datasets/64653>\
**Category:** Ignition\
**Created:** [September 29, 2022, 1:56pm UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653 "2022-09-29T13:56:49Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [September 29, 2022, 1:56pm UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/1 "2022-09-29T13:56:50Z")

</div>

how can I concat Two datasets?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [September 29, 2022, 1:58pm UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/2 "2022-09-29T13:58:29Z")

</div>

[https://docs.inductiveautomation.com/display/DOC81/system.dataset.appendDataset](https://docs.inductiveautomation.com/display/DOC81/system.dataset.appendDataset)

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [September 29, 2022, 3:40pm UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/3 "2022-09-29T15:40:47Z")

</div>

thank you but it not work because my dataset2 have 5 columns and other 3 columns.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/5/1502b2c7ef80117bfda7427fc3dcc4dbb65c6b95.png)

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [September 29, 2022, 3:48pm UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/4 "2022-09-29T15:48:45Z")

</div>

You are going to have to write a script to iterate through the datasets and do this manually then. I would recommend reading through this and try your hand at writing a script - [Datasets - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Datasets)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [September 30, 2022, 3:56am UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/5 "2022-09-30T03:56:54Z")

</div>

@sebastien_ng  
Here is an example I created for somebody a little while back. It takes a dataset from a custom property, and a dataset from a tag and stitches them together into a data table using a common column. Once you get your head around the scripting, you probably won't too much trouble modifying this example to fit your usage case:

> [@Added column shows in Designer but not in client](https://forum.inductiveautomation.com/t/added-column-shows-in-designer-but-not-in-client/63199/9):
>
> You could start with adding a custom dataset property to the power table. Call it originalData. Then bind that property to the SQL query to get the noteless data from the database. The query will have to include a primary key Then, you could create a dataset memory tag with two columns: “name of Primary Key” and “Notes” Afterwards, you would be able to create a custom method called “refreshTable” The code for the custom method would look like this: system.db.refresh(self,"originalData") da…

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 30, 2022, 10:10am UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/6 "2022-09-30T10:10:36Z")

</div>

So you basically want the equivalent of an SQL join ?  
Where do the datasets come from ?  
What should be joined on ? Or will they always have the same number of rows, in the right order ?

Without more details, the simplest solution would be

```python
for i in range(dataset2.getColumnCount):
    dataset1 = system.dataset.addColumn(
        col=dataset2.getColumnAsList(i),
        colName=dataset2.getColumnName(i),
        colType=dataset2.getColumnType(i)
    )

```

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [September 30, 2022, 10:21am UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/7 "2022-09-30T10:21:05Z")

</div>

Yes I want the equivalent of an SQL join

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [September 30, 2022, 10:24am UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/8 "2022-09-30T10:24:12Z")

</div>

And the number of rows are differents

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 30, 2022, 10:25am UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/9 "2022-09-30T10:25:44Z")

</div>

Then what do you join them on ? How should they be joined if they're not the same length ?

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [September 30, 2022, 11:06am UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/10 "2022-09-30T11:06:27Z")

</div>

yes with differents length.

table1: 5x3 and table2: 4x6

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 30, 2022, 11:34am UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/11 "2022-09-30T11:34:29Z")

</div>

That doesn't answer my question.  
I'll try to rephrase:  
With an SQL join, you use a column to match rows from one table to rows from another one:

```sql
select * from table_a
inner join table_b on table_a.column_name = table_b.column_name

```

What column should be used to match rows in your datasets ? There's nothing there that could be used for this, so we need a way to know HOW the datasets should be joined.  
Maybe show us with different datasets, of different lengths.

If you're not comfortable with English, try in your own language and we'll do what we can.  
As it is, there's no proper solution to your problem.

---

<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 30, 2022, 11:36am UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/12 "2022-09-30T11:36:27Z")

</div>

You need something that is similar between the two tables.

For instance, in SQL you tell it what to join on.

```sql
SELECT * FROM SomeTable
JOIN SomeTableA on SomeTable.SomeColumn = SomeTableA.SomeColumn

```

So the tables are different lengths and widths, how should the system decide which rows from Table 2 match up to the rows from Table 1?

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [September 30, 2022, 11:51am UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/13 "2022-09-30T11:51:54Z")

</div>

I'am Sorry, I want do it in ignition perspective . I have dataset1 and dataset2 dataset = dataset1 concat dataset2

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/6/26ff2909fd32a740de418d864fea9f983dcc757c.png)

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 30, 2022, 11:54am UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/14 "2022-09-30T11:54:02Z")

</div>

You need to read more carefully.  
We can't help you if you don't answer our questions.

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [September 30, 2022, 12:28pm UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/15 "2022-09-30T12:28:20Z")

</div>

if the rows from table 2\> table1 in this case, I will write defauts values in the rows of table1 to have the same number of rows.  
Exmple:

table2 : 2x3

name age  
AA 12

BB 35

CC 10

if I have Table1 :1x3

I will put defaut value on the other rows:

Country City age  
Angola Luanda 12

XX XX 00

XX XX 00

---

<div class="post-metadata">

**Author:** ![Vatsal\_Shah](https://avatars.discourse-cdn.com/v4/letter/v/0ea827/32.png) [@Vatsal\_Shah](https://forum.inductiveautomation.com/u/Vatsal_Shah)\
**Post date:** [March 3, 2024, 5:06pm UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/16 "2024-03-03T17:06:07Z")

</div>

Hey if solved pls do post the solution  
Im looking something like this

---

<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:** [March 3, 2024, 5:19pm UTC](https://forum.inductiveautomation.com/t/concat-two-datasets/64653/17 "2024-03-03T17:19:55Z")

</div>

Consider starting a new topic that explains precisely what you have and precisely what you want to get, and in what environment. Tag the new topic with your Ignition version and front-end UI type (Perspective vs. Vision). This topic is too confused for "something like this" to be meaningful.
