# Will this work for dataset?

**URL:** <https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234>\
**Category:** Ignition\
**Created:** [June 26, 2021, 8:17am UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234 "2021-06-26T08:17:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![thiamweekhoo](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@thiamweekhoo](https://forum.inductiveautomation.com/u/thiamweekhoo)\
**Post date:** [June 26, 2021, 8:17am UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234/1 "2021-06-26T08:17:34Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 26, 2021, 9:29am UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234/2 "2021-06-26T09:29:37Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![thiamweekhoo](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@thiamweekhoo](https://forum.inductiveautomation.com/u/thiamweekhoo)\
**Post date:** [June 26, 2021, 10:12am UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234/3 "2021-06-26T10:12:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![thiamweekhoo](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@thiamweekhoo](https://forum.inductiveautomation.com/u/thiamweekhoo)\
**Post date:** [June 26, 2021, 2:07pm UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234/4 "2021-06-26T14:07:28Z")

</div>

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](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/c/6cda91660af20030f160e5c462f314ae3ed25e87.png)

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 26, 2021, 3:38pm UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234/5 "2021-06-26T15:38:32Z")

</div>

Just use `system.dataset.clearDataSet`

---

<div class="post-metadata">

**Author:** ![thiamweekhoo](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@thiamweekhoo](https://forum.inductiveautomation.com/u/thiamweekhoo)\
**Post date:** [June 26, 2021, 4:59pm UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234/7 "2021-06-26T16:59:26Z")

</div>

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](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/c/ec07f7d7bc9a47afc9161b071560dcb55a0d3824.png)

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 26, 2021, 5:02pm UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234/8 "2021-06-26T17:02:55Z")

</div>

> [@thiamweekhoo](#):
>
> ```auto
> data = system.tag.read("[edge]TestingDataset2").value
> system.tag.write("[edge]TestingDataset2").value = system.dataset.clearDataset(data)
> 
> ```

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:

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

```

or, more clearly and with better diagnostic potential:

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

```

---

<div class="post-metadata">

**Author:** ![thiamweekhoo](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@thiamweekhoo](https://forum.inductiveautomation.com/u/thiamweekhoo)\
**Post date:** [June 26, 2021, 5:29pm UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234/9 "2021-06-26T17:29:39Z")

</div>

Thanks nminchin 🙂

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

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 26, 2021, 5:32pm UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234/10 "2021-06-26T17:32:59Z")

</div>

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?)

---

<div class="post-metadata">

**Author:** ![thiamweekhoo](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@thiamweekhoo](https://forum.inductiveautomation.com/u/thiamweekhoo)\
**Post date:** [June 26, 2021, 5:46pm UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234/11 "2021-06-26T17:46:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 26, 2021, 5:54pm UTC](https://forum.inductiveautomation.com/t/will-this-work-for-dataset/48234/12 "2021-06-26T17:54:10Z")

</div>

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
