# Remove Columns From Comments Dataset Before Emailing

**URL:** <https://forum.inductiveautomation.com/t/remove-columns-from-comments-dataset-before-emailing/3067>\
**Category:** Ignition\
**Created:** [July 7, 2011, 2:28pm UTC](https://forum.inductiveautomation.com/t/remove-columns-from-comments-dataset-before-emailing/3067 "2011-07-07T14:28:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidamcg](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@aidamcg](https://forum.inductiveautomation.com/u/aidamcg)\
**Post date:** [July 7, 2011, 2:28pm UTC](https://forum.inductiveautomation.com/t/remove-columns-from-comments-dataset-before-emailing/3067/1 "2011-07-07T14:28:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [July 7, 2011, 2:58pm UTC](https://forum.inductiveautomation.com/t/remove-columns-from-comments-dataset-before-emailing/3067/2 "2011-07-07T14:58:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![aidamcg](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@aidamcg](https://forum.inductiveautomation.com/u/aidamcg)\
**Post date:** [July 7, 2011, 3:31pm UTC](https://forum.inductiveautomation.com/t/remove-columns-from-comments-dataset-before-emailing/3067/3 "2011-07-07T15:31:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [July 7, 2011, 3:42pm UTC](https://forum.inductiveautomation.com/t/remove-columns-from-comments-dataset-before-emailing/3067/4 "2011-07-07T15:42:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aidamcg](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@aidamcg](https://forum.inductiveautomation.com/u/aidamcg)\
**Post date:** [July 7, 2011, 3:45pm UTC](https://forum.inductiveautomation.com/t/remove-columns-from-comments-dataset-before-emailing/3067/5 "2011-07-07T15:45:38Z")

</div>

Hi Travis

Just spotted that it had to be changed to a pydata set. It is working now

Thanks

Aidan
