Will this work for dataset?

Tried script below and it doesn’t work. Why ?
Only applicable for table component ?

data1 = system.tag.read("[edge]TestingDateset1").value
data2 = system.tag.read("[edge]TestingDateset2").value
comboData = system.dataset.appendDataset(data2, data1)
system.tag.write("[edge]TestingDataset2",comboData)

I’m blind. Ignore that system.tag.read returns a QualifiedValue object which has 3 properties, value, timestamp, and quality. You want to read the value to get the dataset.
Also, you should always try to use readAll to read multiple tags at once as it’s far more efficient

Looks like it should work though. What’s the error?

it does not shows error just that I am not getting the result i am expecting. after several trial, it worked ! maybe some typo error in between.

with the dataset created, is there any ways to delete all the rows at once ? it seems like below script will require me to determine the row to be deleted. I will not have any idea on number of rows created. any idea how can I i delete all the rows when I click on the button ?

ds = system.tag.read("[edge]TestingDataset2").value
rows = [0,1,2,3]
ds = system.dataset.deleteRows(ds, rows)
system.tag.read("[edge]TestingDataset2").value = ds

Using below script , I was able to delete all the row for the dataset tag and retain the column datatypes. however, I received this error. Any idea why ?

from com.inductiveautomation.ignition.common import BasicDataset
ds = system.tag.read("[edge]TestingDataset2").value
system.tag.write("[edge]TestingDataset2").value = BasicDataset(ds.getColumnNames(), ds.getColumnTypes(), None)

Untitled123

Just use system.dataset.clearDataSet

i use below script, able to delete all the row. but i got this error at the same time

data = system.tag.read("[edge]TestingDataset2").value
system.tag.write("[edge]TestingDataset2").value = system.dataset.clearDataset(data)

Untitled123

2 things:

  • the system.tag.write function takes 2 arguments, the tagpath and the value to write it to
  • the system.tag.write function doesn’t have a value property or method

You need to use:

data = system.tag.read("[edge]TestingDataset2").value
system.tag.write("[edge]TestingDataset2", system.dataset.clearDataset(data))

or, more clearly and with better diagnostic potential:

data = system.tag.read("[edge]TestingDataset2").value
data = system.dataset.clearDataset(data)
system.tag.write("[edge]TestingDataset2", data)

Thanks nminchin :slight_smile:

may I know can I use this in tag event script ? try it but no luck…
sorry, I am quite new with Ignition here

No worries. Yes you should be able to use it in a tag event script, you’ll need the compute edge module installed though when running Edge (although it looks like you’re running an older version - what version are you using?)

I am using Ignition Edge Panel Version 8.0.10 without compute Edge module.
Hmm, with that said, it means I cannot use the tag event script ?
I also noticed I do not have Gateway Event Script. I could only use Client Event Script now

Without Compute, you can’t execute any gateway event scripts including tag change events, gateway scripts (timer, tag change, etc.). Not sure if there’s anything else