# Add a second t\_stamp to a dataset is failing

**URL:** <https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [August 18, 2025, 6:58pm UTC](https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904 "2025-08-18T18:58:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [August 18, 2025, 6:58pm UTC](https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904/1 "2025-08-18T18:58:14Z")

</div>

I’m trying to show both the epoch and local standard time next to each other from the output of a system.tag.queryTagHistory result.

The function call works fine, I’m putting the result on a custom value in the root of a page. Then I added a script transform to duplicate the t\_stamp as t\_stamp\_readable and tried to add it as a java.util.timestamp but when I try to add the column to a dataset, it throws an error that I cant add a timestamp to a dataset.

Am I doing something wrong or should I try to add it as a string or something else? Any suggestions? Thanks!

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [August 18, 2025, 8:18pm UTC](https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904/2 "2025-08-18T20:18:08Z")

</div>

Show the error(s) you are getting here. Post either your code or an example of the code you are using to attempt to add a column to the dataset. Make sure to post it as pre-formatted text, see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831) .

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [August 18, 2025, 9:13pm UTC](https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904/3 "2025-08-18T21:13:06Z")

</div>

Line 9 is the return and the error is with java.sql.timestamp. Changing the type to str and java.util.date threw errors too. date couldn’t be coerced to a string and cant put a java.sql.timestamp into a java.util.date respectively. Thanks!

CODE:

```python
def transform(self, value, quality, timestamp):
	import java.sql.Timestamp
	
	newColumneData = []
	for row in range(value.getRowCount()):
		tstamp_new = value.getValueAt(row, 't_stamp')
		newColumneData.append(tstamp_new)
	
	return system.dataset.addColumn(value, 0, newColumneData, 't_stamp_readable', java.sql.Timestamp)	

```

ERROR:

`Error_ScriptEval(“Traceback (most recent call last): File ““, line 9, in transform TypeError: Cant put element of type timestamp in dataset. “)`

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 18, 2025, 9:22pm UTC](https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904/4 "2025-08-18T21:22:56Z")

</div>

> [@drewdin](#):
>
> doing something wrong

If you _must_ manipulate time zone display yourself, you will suffer with `java.util.Date` and its subclasses (which includes `java.sql.Timestamp`) because they are zone-less objects. They parse and stringify in the JVM's default time zone, and you cannot use datetime arithmetic to correct this (produces subtle bugs).

Instead, create a `java.time.Instant`, and then a `ZonedDateTime` in the desired zone to print. That can be stringified reliably. (Use a date/time formatter for precise control.)

> [@Ignition Perspective Page to show the client System date and time](https://forum.inductiveautomation.com/t/ignition-perspective-page-to-show-the-client-system-date-and-time/73265/8):
>
> Sure. I recommend [DateTimeFormatter.ofPattern()](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/format/DateTimeFormatter.html#ofPattern(java.lang.String)). But I would move the complexity to a project script module with a DateTimeFormatter instance with your preferred pattern saved as a top level variable. Like so, perhaps: from java.time import ZoneId from java.time.format import DateTimeFormatter defaultFormatter = DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm") def zonedFormat(ts, zoneid, format=None): formatter = defaultFormatter if format is None else DateTimeFormatter.ofPattern(format) r…

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 18, 2025, 9:27pm UTC](https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904/5 "2025-08-18T21:27:10Z")

</div>

You will need to use the Dataset Builder. Which will allow you to specify the types for the columns.

> **[DatasetBuilder](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.49/com/inductiveautomation/ignition/common/util/DatasetBuilder.html)**
>
> declaration: package: com.inductiveautomation.ignition.common.util, class: DatasetBuilder

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [August 18, 2025, 9:42pm UTC](https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904/6 "2025-08-18T21:42:56Z")

</div>

Thanks for the input, do you recommend a different way to display the same date twice from the queryTagHistory function? I’m not married to the idea of adding it twice if there is a better way, thanks again!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 18, 2025, 10:15pm UTC](https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904/7 "2025-08-18T22:15:30Z")

</div>

Adding another column to the source data is reasonable, but it should be a string produced from a ZonedDateTime, not another date object. Objects that aren't native JSON don't transfer to the front-end well.

If displaying in a Perspective table, you might avoid adding the raw data column by using a column render view that takes the one column and display both forms. (This will really only be helpful for large virtualized tables.)

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [August 19, 2025, 1:59am UTC](https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904/8 "2025-08-19T01:59:31Z")

</div>

> [@pturmel](#):
>
> column render view

Is a column render view a sub view or something different? Thanks!

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 19, 2025, 7:59am UTC](https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904/9 "2025-08-19T07:59:52Z")

</div>

See [Embedding a view in a table-cell](https://docs.inductiveautomation.com/docs/8.1/appendix/components/perspective-components/perspective-display-palette/perspective-table/table-column-configurations#embedding-a-view-in-a-table-cell).

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [August 20, 2025, 2:17am UTC](https://forum.inductiveautomation.com/t/add-a-second-t-stamp-to-a-dataset-is-failing/109904/10 "2025-08-20T02:17:55Z")

</div>

That worked well for me, thanks.
