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