I have two table son one ignition window. I am trying to join the two tables but getting the error- Invalid object name for tables. How do I select the columns if there is an error finding the table itself?
Any help? Below is the error
===
Exception: Error running query:
SQLQuery(query=SELECT IDandName.FaultName,
IDandCount.FaultCount
FROM IDandCount
INNER JOIN IDandName ON IDandCount.FaultID = IDandName.FaultID, database=MORPSQL_Ignite)@0ms
On: CIPFaults.Root Container.NameAndCount.data
caused by GatewayException: Invalid object name ‘IDandCount’.
caused by SQLServerException: Invalid object name ‘IDandCount’.
If you just want to combine the data from both tables into a single dataset, you can script a propertyChange event and append the datasets using system.dataset.appendDataset(). This requires that both datasets columns match.
Thanks guys. I have tried system.dataset.appendDataset() but it says there is an error in Line1 char6, which is “.”. I really don’t understand this error.
I have these two tables (see screenshot) and I need to create a 3rd table with columns FaultName and FaultCount. It is simple if the tables are SQL tables as you can access the columns. But ignition tables doesn’t have column selection. And appendDataset not working as well. Any ideas? Can it be achieved in ignition at all?
Off the top of my head.
Will be better with list comprehension but this will get you started.
ds1 = system.dataset.toPyDataSet(event.source.parent.getComponent('Power Table').data)
ds2 = system.dataset.toPyDataSet(event.source.parent.getComponent('Power Table 1').data)
tbl = event.source.parent.getComponent('Power Table 2')
ds3 = []
hdr=['faultID','FaultName','FaultCount']
for x in ds1:
for f in ds2:
if f[0]==x[0]:
ds3.append([x[0],x[1],f[1]])
tbl.data = system.dataset.toDataSet(hdr,ds3)