# Select multiple checkboxes in a table - Perspective

**URL:** <https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 22, 2021, 5:14pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254 "2021-10-22T17:14:38Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![augusto.junior](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@augusto.junior](https://forum.inductiveautomation.com/u/augusto.junior)\
**Post date:** [October 22, 2021, 5:14pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/1 "2021-10-22T17:14:38Z")

</div>

Hi guys,

I need to select multiple rows in a table and send the values to a label in another view.  
I tried to use the checkbox column to select them, but I can only check one at a time. The selection mode is set to multiple interval.  
What am I missing?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/1/d15d1e2dee07fa3f3de1231d3975d149246509ac.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/e/0e1a4762225b4788b2b11a10538224f9e7b180ef.png)

Thanks!

---

<div class="post-metadata">

**Author:** ![augusto.junior](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@augusto.junior](https://forum.inductiveautomation.com/u/augusto.junior)\
**Post date:** [November 1, 2021, 7:38pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/2 "2021-11-01T19:38:41Z")

</div>

Did anyone get this to work?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 2, 2021, 8:42am UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/3 "2021-11-02T08:42:11Z")

</div>

How are you setting the check box (for the single row)?  
With the mode multiple interval you can select multiple rows using ctrl + click or shift + click (for a range)

---

<div class="post-metadata">

**Author:** ![augusto.junior](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@augusto.junior](https://forum.inductiveautomation.com/u/augusto.junior)\
**Post date:** [November 2, 2021, 11:58am UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/4 "2021-11-02T11:58:19Z")

</div>

We will use the system on phones and tablets as well. The shift + click or ctrl + click works fine on computers, but not on these touch devices.  
I wondering to just touch the checkboxes to make multiple selections like ctrl + click.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 2, 2021, 1:01pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/5 "2021-11-02T13:01:07Z")

</div>

add an onRowClick() event on the table:

something like if you use json format: (if column name is checkbox)  
`self.props.data[event.row].checkbox = not event.value.checkbox`

then you can send all the data where checkbox==true

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [November 16, 2021, 8:37am UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/6 "2021-11-16T08:37:41Z")

</div>

> [@victordcq](#):
>
> event.value.

i did scripting on onRowClick() event on the table  
the table data needs to update to the database when the checkbox is selected.

Below is the checkbox column prop...I have created a view for checkbox coz by selecting render as boolean and boolean prop as checkbox, it should be clicked twice to select the checkbox

below is my code for checkbox column.... i tried passing vcheckbox=="true" also but getting error for both

```auto
       vcheckbox=self.props.data[event.rowIndex].isselected
	system.perspective.print(vcheckbox)
	
	if vcheckbox==1:
		system.perspective.print("checkbox:true")
	else:
		system.perspective.print("checkbox:false")

```

error is:

```auto
caused by org.python.core.PyException
Traceback (most recent call last):
  File "<function:runAction>", line 31, in runAction
TypeError: 'com.inductiveautomation.ignition.gateway.datasource.BasicStreamingDataset' object is unsubscriptable

```

plz help me

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 16, 2021, 8:55am UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/7 "2021-11-16T08:55:19Z")

</div>

> [@manjuyadav95.m](#):
>
> `BasicStreamingDataset`

seems your data is in dataset form not json, to get the value from a dataset you need to do  
`vcheckbox=self.props.data.getValueAt(event.rowIndex, "isselected")` or something  
[https://docs.inductiveautomation.com/display/DOC81/Datasets](https://docs.inductiveautomation.com/display/DOC81/Datasets)

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [November 16, 2021, 9:33am UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/8 "2021-11-16T09:33:29Z")

</div>

> [@victordcq](#):
>
> self.props.data.getValueAt(event.rowIndex, "isselected")

Thanks for your reply

if render selected as view then checkbox reflecting and if auto then blank

if checkbox selected then its value should be passed as 1 or true but I am getting output in console as blank

I need the selected property of checkbox which we can see in normal view but in table's column checkbox I am not getting that property so how can it be handled?

```auto
vcheckbox=self.props.data.getValueAt(event.rowIndex, "isselected")
	system.perspective.print(vcheckbox)

```

o/p got blank after selecting/deselecting checkbox

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 16, 2021, 9:57am UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/10 "2021-11-16T09:57:32Z")

</div>

Yes…

Seems you arent really understanding what is supposed to be happening here.

First of all how are you getting the data? How did you add in the column for isselected?

Are you passing the values down to the view? or is it just a checkbox? Because why arent you just using the boolean render.  
Also you gotta set the value on row click, that was the whole point of not needing two clicks.

```auto
vcheckbox=self.props.data.getValueAt(event.rowIndex, "isselected")
self.props.data = system.dataset.setValue(self.props.data, event.rowIndex, "isselected", not checkbox)

```

you should do this and use boolean render

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [November 16, 2021, 10:33am UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/11 "2021-11-16T10:33:05Z")

</div>

@victordcq ic query binding done to display the data in table and isselected is the column with null value getting from the table and I should pass 1 in isselected column and that entire row’s data to the table only if checkbox is selected else nothing/null/0…

basically I need to pass the row’s data only based on checkbox selection

should I do it on editcell commit ?but how can get the value of checkbox as true/1 or false/0

I want this property in table column of checkbox from where I can achieve it…

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

plz help me

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 16, 2021, 11:41am UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/12 "2021-11-16T11:41:09Z")

</div>

You could send a message when you press the check box but its really just gonna be easier to use the boolean render xd

no editcell required, we are handling the “edit” on row select because it requires one click less (for booleans)

this works for me for a simple dataset with boolean render. Ofc you gotte be sure the dataset isselected is set to boolean. and that the query isnt refreshing else it will overwrite the edits in the data prop

onrowclick event:

`self.props.data = system.dataset.setValue(self.props.data, event.rowIndex, "isselected", not self.props.data.getValueAt(event.rowIndex, "isselected"))`

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [November 16, 2021, 12:17pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/13 "2021-11-16T12:17:40Z")

</div>

> [@victordcq](#):
>
> self.props.data = system.dataset.setValue(self.props.data, event.rowIndex, "isselected", not self.props.data.getValueAt(event.rowIndex, "isselected"))

Isselected column value got changed by clicking row but it needs to be changed only when I tick the checkbox ..if I untick that checkbox again then null/0

How can I send a message when checkbox ticked 🙃

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [November 16, 2021, 12:33pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/14 "2021-11-16T12:33:51Z")

</div>

Plz look at this below img: here under data prop they have boolean value for inactive and other 2 cols…the same way I want it for checkbox column …is it possible?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/9/c975b26d82bfae0a11c9e14ecc807e4a41d5d3da.png)

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 16, 2021, 12:37pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/15 "2021-11-16T12:37:08Z")

</div>

ahhh you can use onselectionchanged then. there you get  
event.selectedRow and event.selectedColumn

you can then do an if on the event.selectedColumn to see if its a boolean column  
and use the script but use event.selectedColumn instead of “isselected”  
and selectedRow sintead of rowindex

heh for some reason this keeps getting triggered for me tho 😕

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [November 16, 2021, 12:44pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/16 "2021-11-16T12:44:20Z")

</div>

checkbox on table column is not possible in perspective?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 16, 2021, 12:47pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/17 "2021-11-16T12:47:46Z")

</div>

seems like you will have to use the edit mode afterall  
enable edit and use oneditcommit  
it requires an extra click tho

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [November 16, 2021, 12:58pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/18 "2021-11-16T12:58:49Z")

</div>

I tried on oneditcellcommt as well but the difficulty is If i deselect the checkbox then also it is passing the value 1 in isselected column 🙃 coz it is taking as edit committed…what can be done to fix it ?  
is there any way to get only boolean value in isselected column like the below image where in data props they added isactive as boolean value

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 16, 2021, 1:34pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/19 "2021-11-16T13:34:58Z")

</div>

show me your code

---

<div class="post-metadata">

**Author:** ![augusto.junior](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@augusto.junior](https://forum.inductiveautomation.com/u/augusto.junior)\
**Post date:** [November 16, 2021, 1:44pm UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/20 "2021-11-16T13:44:41Z")

</div>

Hi,  
It did work for me.  
I have a binding for this table and I’m creating a fake column called Checkbox in the query:

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

Then, I created an event onEditCellCommit with the script:  
**if self.props.selection.data[0].Checkbox == True:**  
**self.props.data[self.props.selection.selectedRow].Checkbox = True**

Finally, I set my button to get all the data from my table where the value on Checkbox column is True.

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [November 18, 2021, 8:09am UTC](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254/21 "2021-11-18T08:09:54Z")

</div>

@augusto.junior @victordcq Thanks for your reply  
I scripted on oneditcellcommit and it has printed the value as true/false in console when I select/deselect this was achieved by printing event.value and in scripting need to use 1/0 instead of true/false and from that value, I have given condition to pass the table row’s checkbox ticked data to database

```auto
checkbox=event.value
	system.perspective.print(checkbox)
if checkbox==1:
	system.perspective.print("true conditn")
else:
       pass

```

[Next page](https://forum.inductiveautomation.com/t/select-multiple-checkboxes-in-a-table-perspective/52254.md?page=2)
