# Perspective table what is props.data, cause scripts don't think it's a dataset

**URL:** <https://forum.inductiveautomation.com/t/perspective-table-what-is-props-data-cause-scripts-dont-think-its-a-dataset/41018>\
**Category:** Ignition\
**Tags:** scripting, ignition80\
**Created:** [November 27, 2020, 4:27pm UTC](https://forum.inductiveautomation.com/t/perspective-table-what-is-props-data-cause-scripts-dont-think-its-a-dataset/41018 "2020-11-27T16:27:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [November 27, 2020, 4:27pm UTC](https://forum.inductiveautomation.com/t/perspective-table-what-is-props-data-cause-scripts-dont-think-its-a-dataset/41018/1 "2020-11-27T16:27:56Z")

</div>

So I used the control to add a line of bogus data so the columns would show up, when I do this:

```
unitList = caller.getSibling("Units")
ds = system.dataset.clearDataset(unitList.props.data)

```

I get an error thrown that props.data isn’t a dataset. I’ve tried toPyDataSet but it tells me it’s not a dataset as well. Not sure how to work with the tables data.Thx, jake

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [November 27, 2020, 5:22pm UTC](https://forum.inductiveautomation.com/t/perspective-table-what-is-props-data-cause-scripts-dont-think-its-a-dataset/41018/2 "2020-11-27T17:22:13Z")

</div>

> [@codersmurf](#):
>
> caller.getSibling("Units")

You didn't specify what this component is or how its props.data is populated so I'll pretend it's a Dropdown using a Named Query on the props.data property. In the binding you can specify the return format and it sounds like you want a dataset.

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

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [November 27, 2020, 5:29pm UTC](https://forum.inductiveautomation.com/t/perspective-table-what-is-props-data-cause-scripts-dont-think-its-a-dataset/41018/3 "2020-11-27T17:29:59Z")

</div>

So it’s a perspective table, I’m not sure what a query binding is or how it’s used. Can it be attached to anything?Thx, jake

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [November 27, 2020, 8:01pm UTC](https://forum.inductiveautomation.com/t/perspective-table-what-is-props-data-cause-scripts-dont-think-its-a-dataset/41018/4 "2020-11-27T20:01:27Z")

</div>

I changed it to an array on the component, which I guess it was already and changed the code to use python array .append to fill the array, now it’s giving me a component error. I’m sending in json with a value and style.

data = [{“value”: value from a tag, “style”: path to a style in project},  
{“value”: value from a tag, “style”: path to a style in project},  
…  
]

ds.append(data)  
table.props.data = ds

Thx,jake

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 27, 2020, 8:11pm UTC](https://forum.inductiveautomation.com/t/perspective-table-what-is-props-data-cause-scripts-dont-think-its-a-dataset/41018/5 "2020-11-27T20:11:02Z")

</div>

> [@codersmurf](#):
>
> now it’s giving me a component error

Could you provide a screenshot?  
Could you provide the actual code, as opposed to the pseudo-code you provided? Pseudo-code is the absolute worst thing to provide when you're encountering an error in your code.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [November 27, 2020, 9:50pm UTC](https://forum.inductiveautomation.com/t/perspective-table-what-is-props-data-cause-scripts-dont-think-its-a-dataset/41018/6 "2020-11-27T21:50:29Z")

</div>

code  
…  
import time  
def GetColor(unit):  
d = system.tag.readBlocking([’[default]’ + unit + ‘.enabled’])[0].value  
if d == False:  
return ‘status\_darker\_blue’  
s = system.tag.readBlocking([’[default]’ + unit + ‘/Status’])[0]  
if s.quality.isGood() == False:  
return ‘status\_light\_grey’  
else:  
fp = ‘[default]’ + unit + ‘/Faulted’  
if False:  
#if system.tag.exists(fp) == True:  
f = system.tag.readBlocking(fp)[0]  
if f.value == True:  
color = ‘status\_light\_grey’  
else:  
color = ‘status\_white’  
else:  
sn = system.tag.readBlocking([’[default]’ + unit + ‘/StatusNormal’])[0]  
norms = sn.value.split(’,’)  
color = ‘status\_red’  
for norm in norms:  
if s.value == int(norm):  
color = ‘status\_white’  
break  
return color

def Load(caller):  
units\_tag = caller.session.props.auth.user.userName  
hide\_customer = False;  
if units\_tag == ‘TOPSDemo’:  
hide\_customer = True

```
units = system.tag.readBlocking(['[default]' + units_tag + '/Units'])[0].value.split(',')

unitList = caller.getSibling("Units")
#ds = system.dataset.clearDataset(unitList.props.data)
ds = []

for unit in units:
	#system.gui.messageBox(unit)
	color = GetColor(unit)
	company = ""
	location = ""
	volts = ""
	d = system.tag.readBlocking(['[default]' + unit + '.enabled'])[0].value
	if d == False:
		comploc = system.tag.readBlocking(['[default]Disabled-' + unit])[0].value.split(',')
		company = comploc[0]
		location = comploc[1]
		volts = "NA"
	else:
		if hide_customer == True:
			company = 'NA'
			location = 'NA'
		else:
			company = system.tag.readBlocking(['[default]' + unit + '/Company'])[0].value
			location = system.tag.readBlocking(['[default]' + unit + '/Location'])[0].value
		compv = system.tag.readBlocking(['[default]' + unit + '/CompMainsVoltage'])[0]
		if compv and compv.quality.isGood() == True:
			volts = "%4.1f" % compv.value
		else:
			volts = "NA"
	data = [{"value": unit, "style": color}
			,{"value": company, "style": color}
			,{"value": location, "style": color}
			,{"value": volts, "style": color}]
	ds.append(data)

unitList.props.data = ds

```

…
