# Ignition Perspective Table Add/Delete Rows

**URL:** <https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [February 28, 2023, 3:42pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426 "2023-02-28T15:42:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![R\_P](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@R\_P](https://forum.inductiveautomation.com/u/R_P)\
**Post date:** [February 28, 2023, 3:42pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426/1 "2023-02-28T15:42:34Z")

</div>

Hi All,

I am using button to add/delete rows in Table in Perspective.

I am using code below but its not working

data = self.getSibling("Table").props. Data  
newRow = {'EQUIP\_NOS': '', 'EQUIP\_NAME': '', 'EQUIP\_STATUS':'','PLANT\_SECTION':'', 'SCHEDULE\_TYPE':'', 'OPERATOR':''}  
data.append(newRow)  
self.getSibling("Table").props. Data = data

I am getting error  
File "function:runAction", line 4, in runAction  
AttributeError: 'com.inductiveautomation.ignition.gateway.datasourc' object has no attribute 'append'

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [February 28, 2023, 4:02pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426/2 "2023-02-28T16:02:51Z")

</div>

Please use the \</\> button to format your code so we can read it clearly.

Also, we need to know how you are populating the table.

Where are your binding and to what? (for the data)

the error is clear you are. append isn't working. But we have to get to the root of how you are doing this for an answer.

Is it a static table? If it's dynamic, you will have to script it differently. If it's a query you will need to be updating the database.

---

<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:** [February 28, 2023, 4:07pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426/3 "2023-02-28T16:07:37Z")

</div>

`self.getSibling("Table").props.data` is not the type of object you are expecting.

As @andrews says though, we will need to know how you have configured the table to be able to truly help you arrive at an answer.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [February 28, 2023, 4:07pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426/4 "2023-02-28T16:07:52Z")

</div>

The data type (dataset) of the dataset returned by `self.getSibling("Table").props.Data` has no method `.append()` (append is typically for a list type, which this is not). Most likely you want to use `system.dataset.addRow()`

---

<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:** [February 28, 2023, 4:15pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426/5 "2023-02-28T16:15:08Z")

</div>

> [@amarks](#):
>
> Most likely you want to use `system.dataset.addRow()`

By default this prop is an Object Structure, so unless there is a binding that is converting the type to a dataset it's probably not a dataset. If there is a binding to a dataset, then what really needs to be done is an update to where ever that data is being pulled from.

---

<div class="post-metadata">

**Author:** ![R\_P](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@R\_P](https://forum.inductiveautomation.com/u/R_P)\
**Post date:** [February 28, 2023, 5:31pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426/6 "2023-02-28T17:31:14Z")

</div>

> [@amarks](#):
>
> system.dataset.addRow()

Thanks All,  
I want add/ delete rows for table stored in Sql Lite Database  
I am using name query to access Asset\_Data Table which is empty now.  
After using name query "SELECT \* FROM Asset\_Data" , i got all columns in table which i have created in Asset\_Data table.  
But now all are empty. So i want to add row by button then i will enter data and must be stored in table in Sql Lite Database

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [February 28, 2023, 5:42pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426/7 "2023-02-28T17:42:20Z")

</div>

Hard to give an example without knowing the data. Also this shows you are not providing all your code.

Please provide your full script. So we can see how you query, what you do with it etc...

Where is your query, and where is your script?

Presumably you will need to run an update query to change the table while passing in params.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [February 28, 2023, 6:50pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426/8 "2023-02-28T18:50:37Z")

</div>

You'll need to use a property change script to run an update query to add/remove rows from your database.

---

<div class="post-metadata">

**Author:** ![R\_P](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@R\_P](https://forum.inductiveautomation.com/u/R_P)\
**Post date:** [February 28, 2023, 7:45pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426/9 "2023-02-28T19:45:16Z")

</div>

Hi Andrewa,

Please see image below.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/a/aa2bfe1554212937f0c577bf182fe883c59c3da8.png)  
On Data, i configured named query as per below image.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/c/7c5c279ea22a1a630f3f7b78aaeca73bee9df05d.png)  
Table is empty now. So i want to add row after click on button and then enter details that also need to stored in Asset\_Data table

---

<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:** [February 28, 2023, 8:58pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-table-add-delete-rows/70426/10 "2023-02-28T20:58:00Z")

</div>

> [@R\_P](#):
>
> Sql Lite Database

A word of caution. SQL Lite is not really meant for a production environment. If you are looking for a free DB you can use PostgresSQL or MongoDB. If this is intended for a production environment I would strongly recommend you get a more powerful DB package.

> [@R\_P](#):
>
> Table is empty now. So i want to add row after click on button and then enter details that also need to stored in Asset\_Data table

To add a row to the table you will need to run an Insert query.

Probably the simplest way to achieve this is to create a Named Query for the insert and then call it from the onActionPerformed event.

I would recommend naming queries in a way that lets you know what they do. For instance I see that you have named your query "query". But with out looking at the actual query there is no way of knowing what that query does. Is it selecting data, inserting data, updating data, or deleting data? What data is it working on?

Something like "getAssetData" or "selectAssetData" is a much better name. It tells the programmer what is happening without needing to know the how of it.

So in this case, you will need an Insert query to add a non existing row, so a name like "insertNewAssetData" is appropriate.

The query will look something like:

```auto
INSERT INTO Asset_Data
VALUES (value1,value2,value3,....)

```

NOTE: You will need a value for every column in the table. Value1 will be inserted into Column 1

Then in the buttons `onActionPerformed` event, configure a script action where you collect the information and then run the named query using `system.db.runNamedQuery()`

If you want to update an already existing row in the table, then you will need to run an UPDATE query.
