Hi
I am using the comments table as a log of issues during a shift and then sending the table contents as a HTML email at shift end. I have it all working ok but I need some guidance on how to remove some of the columns from the comments dataset before sending the Email. I want to remove the ID,AttachmentFilename and Stick columns. I would also like to rename the columns before sending and was wondering if this is possible as well. I am using 7.2.4.
Thanks
Aidan
In this case you have to create a new dataset from the original but without those columns. Something like:header = ["Note", "TStamp", ...]
data = []
oldData = event.source.parent.getComponent("Comments Panel").data
for row in oldData:
data.append([row[1], row[2], ...])
newDS = system.dataset.toDataSet(header, data)
system.dataset.exportHTML("data.html", 1, newDS,"Comments Report")
Hope this helps.
Hi Travis
I am getting the following error [color=#FF0000]“Traceback (innermost last): File “event:actionPerformed”, line 4, in ?AttributeError: getitem”[/color]
I have mapped the oldData to the comments panel so not sure what is wrong
Thanks
Aidan
Sorry change the following line:oldData = event.source.parent.getComponent("Comments Panel").data
to this:oldData = system.dataset.toPyDataSet(event.source.parent.getComponent("Comments Panel").data)
Hi Travis
Just spotted that it had to be changed to a pydata set. It is working now
Thanks
Aidan