# Initializing Memory Tag Dataset on View Startup

**URL:** <https://forum.inductiveautomation.com/t/initializing-memory-tag-dataset-on-view-startup/113440>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 21, 2026, 8:44am UTC](https://forum.inductiveautomation.com/t/initializing-memory-tag-dataset-on-view-startup/113440 "2026-01-21T08:44:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TechEnlive](https://avatars.discourse-cdn.com/v4/letter/t/3be4f8/32.png) [@TechEnlive](https://forum.inductiveautomation.com/u/TechEnlive)\
**Post date:** [January 21, 2026, 8:44am UTC](https://forum.inductiveautomation.com/t/initializing-memory-tag-dataset-on-view-startup/113440/1 "2026-01-21T08:44:05Z")

</div>

Hi Team,

I am trying to create a dataset as a **Memory Tag** when the view starts. The logic should be:

- If the dataset already exists, do nothing.

- Otherwise, create the dataset.

I have attempted the following code, but it is **not working as expected**. Could you please advise on the correct approach to achieve this?

```python
def runAction(self):
	
	from datetime import datetime
	tagPath = "[default]ds_cutlist"
	
	ds = system.tag.readBlocking([tagPath])[0].value
	
	if ds is None or ds.getRowCount() == 0:
	
	    headers = [
	        "btns",
	        "orderid",
	        "bundleid",
	        "panel_qty",
	        "length",
	        "overlap_length",
	        "stopper1",
	        "stopper2",
	        "stopper3",
	        "stopper4",
	        "1st",
	        "last",
	        "mid",
	        "bundle_height"
	    ]
	
	    defaultRow = [
	        "", "", "",
	        0, 0, 0,
	        True, True, True, True,
	        "", "", "",
	        0.0
	    ]
	
	    system.tag.writeBlocking(
	        [tagPath],
	        [system.dataset.toDataSet(headers, [defaultRow])]
	    )

```

Thank you!

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 21, 2026, 2:59pm UTC](https://forum.inductiveautomation.com/t/initializing-memory-tag-dataset-on-view-startup/113440/3 "2026-01-21T14:59:41Z")

</div>

> [@TechEnlive](#):
>
> **not working as expected**.

Well, that narrows it down to just about everything... 😉

if you are looking to create the tag, then you need to use _system.tag.configure()_ It will also work to set a default value.

```python
def runAction(self):
	
	from datetime import datetime
	tagPath = "[default]ds_cutlist"
	logger = system.util.getLogger('tag')
	
	# if the tag exists and has rows in it, then exit the function.
	if system.tag.exists(tagPath)
        ds = system.tag.readBlocking([tagPath])[0].value
        if ds.rowCount > 0:
            return
	
	collisonPolicy = 'o'
	tagConfig = {u'dataType': DataSet, 
              u'path': '[default]ds_cutlist', 
              u'tagType': 'AtomicTag', 
              u'name': u'ds_cutlist', 
              u'valueSource': u'memory', 
              u'value': [[u'', u'', u'', 0, 0, 0, True, True, True, True, u'', u'', u'', 0.0]]
             }
    
    system.tag.configure('[default]', [tagConfig], collisonPolicy)

```

---

<div class="post-metadata">

**Author:** ![TechEnlive](https://avatars.discourse-cdn.com/v4/letter/t/3be4f8/32.png) [@TechEnlive](https://forum.inductiveautomation.com/u/TechEnlive)\
**Post date:** [January 21, 2026, 3:17pm UTC](https://forum.inductiveautomation.com/t/initializing-memory-tag-dataset-on-view-startup/113440/4 "2026-01-21T15:17:34Z")

</div>

> [@JordanCClark](#):
>
> ```python
> from datetime import datetime
> tagPath = "[default]ds_cutlist"
> logger = system.util.getLogger('tag')
> 	
> # if the tag exists and has rows in it, then exit the function.
> if system.tag.exists(tagPath)
> ds = system.tag.readBlocking([tagPath])[0].value
> if ds.rowCount > 0:
> return
> 	
> collisonPolicy = 'o'
> tagConfig = {u'dataType': DataSet, 
> u'path': '[default]ds_cutlist', 
> u'tagType': 'AtomicTag', 
> u'name': u'ds_cutlist', 
> u'valueSource': u'memory', 
> u'value': [[u'', u'', u'', 0, 0, 0, True, True, True, True, u'', u'', u'', 0.0]]
> }
>     
> system.tag.configure('[default]', [tagConfig], collisonPolicy)
> 
> ```

Thanks a lot.
