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

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

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

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

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

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.

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