# Tags not storing if value is not changing

**URL:** <https://forum.inductiveautomation.com/t/tags-not-storing-if-value-is-not-changing/88141>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [April 1, 2024, 10:16am UTC](https://forum.inductiveautomation.com/t/tags-not-storing-if-value-is-not-changing/88141 "2024-04-01T10:16:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hive121](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@hive121](https://forum.inductiveautomation.com/u/hive121)\
**Post date:** [April 1, 2024, 10:16am UTC](https://forum.inductiveautomation.com/t/tags-not-storing-if-value-is-not-changing/88141/1 "2024-04-01T10:16:12Z")

</div>

Hello,

I am using Ignition Perspective and I have created a page where operators can enter some notes, their initials, and a datetime as shown below:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/0/a0232f02c940d4fe51352b6d7882173813fd0d42.png)

When the "Add" button is clicked, the values entered by the operator are written to tags via system.tag.writeBlocking

The historian of the tags are enabled which stores the values into a database. I am using this page as a log and would like that every time the operator clicks the add button a new entry is stored in the database (even if the values did not change). I am not sure how to make this happen.

Here is the tag group and tag editor properties for one of the tags:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/d/4df8e1a76b2666ebf5a299a580c82e74d44b6690.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/6/962dd585f191d21b5f23330397a4d098c922980a.png)

Thank you

---

<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:** [April 1, 2024, 10:57am UTC](https://forum.inductiveautomation.com/t/tags-not-storing-if-value-is-not-changing/88141/2 "2024-04-01T10:57:32Z")

</div>

You've set max time between sample, with sample mode "On Change", so **of course** you aren't getting a new value in history.

FWIW, this type of data entry, particularly if multiple fields are involved, is utterly inappropriate for the tag historian. Just insert a row into a custom table. That is what databases are for.

---

<div class="post-metadata">

**Author:** ![hive121](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@hive121](https://forum.inductiveautomation.com/u/hive121)\
**Post date:** [April 1, 2024, 11:41am UTC](https://forum.inductiveautomation.com/t/tags-not-storing-if-value-is-not-changing/88141/3 "2024-04-01T11:41:01Z")

</div>

To be honest, I looked into using a database table to build the interface for operators. However, the number of fields they have to enter is more than 50 and using a table with that many columns did not seem user-friendly. I also wanted to treat some of the fields as tag historian because I wanted to be able to plot them with other tags using the adhoc trending tool I think I have an idea and I will give it a shot. Thanks.

Also, I do know that I need to change the sample mode. However, I only see three options "On Change", "periodic", "tag group". None of them seem suitable for what I want to achieve. I want the value to be written again if the user has triggered it via a button. I do not want to change the max time between samples since I do not want a value to be stored if it is not triggered by the user. Can you give me an example of what I need to change to achieve this?

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:** [April 1, 2024, 12:19pm UTC](https://forum.inductiveautomation.com/t/tags-not-storing-if-value-is-not-changing/88141/4 "2024-04-01T12:19:21Z")

</div>

> [@hive121](#):
>
> using a table with that many columns did not seem user-friendly

That's a terrible reason for not using the right tool. In fact, that number of fields makes it even **more** important to use a proper database. The historian does not work the way you need it to.

You can plot pens from regular db tables with the wide table historian provider.

> [@hive121](#):
>
> None of them seem suitable

Because there is no suitable mode for your use-case. You need a proper database table.

> [@hive121](#):
>
> Can you give me an example of what I need to change to achieve this?

There is no such change. The historian cannot do this.

---

<div class="post-metadata">

**Author:** ![hive121](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@hive121](https://forum.inductiveautomation.com/u/hive121)\
**Post date:** [April 1, 2024, 9:39pm UTC](https://forum.inductiveautomation.com/t/tags-not-storing-if-value-is-not-changing/88141/5 "2024-04-01T21:39:04Z")

</div>

@pturmel  
Thank you. I really appreciate your help. I found this video and I am trying to follow along to build a database table historian.

> **[DB Table Historian Video at Inductive University](https://www.inductiveuniversity.com/videos/db-table-historian/8.1/8.1)**
>
> The DB Table Historian provider can process tables created by third-party systems and attempt to interpret the data, making it available to Tag History queries.

So far, I have built a page on perspective which has two fields and an "add" button:

1. ambient\_temperature (perspective component: Numeric Entry Field)
2. t\_stamp (perspective component: DateTime Input)

The "Add" button has the following onClick event:

```auto
def runAction(self, event):

	AmbientTemperatureField = self.parent.getChild("ManualReadingsFlexContainer").getChild("ManualReadingsColumnContainer").getChild("AmbientTemperatureField").props.value
	#ManualReadingLogTimeField = self.parent.getChild("ManualReadingsFlexContainer").getChild("ManualReadingsColumnContainer").getChild("ManualReadingLogTimeField").props.value
	ManualReadingLogTimeField = 1712004373542

	params = {"ambient_temperature":AmbientTemperatureField, "t_stamp":ManualReadingLogTimeField}
	result = system.db.runNamedQuery("Project_Demo", "AddTestDataLog", params)	

```

Side note: I am not sure how to convert the ManualReadingLogTimeField value to EPOC GMT time so I am putting in hardcoded values in for now. Ideally, I want the user to be able to pick the date and time in human readable format but I want it save as EPOC GMT time in database. These are the component properties for the DateTime input component:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/a/baa131b8519f1c7fb345d9a265884dc3279098db.png)

Here is how the "AddTestDataLog" query is setup:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/1/f1ead15716d92da1e2f45bf74dca212cbce35df6.png)

I have the following records in my postgresSQL database so far:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/7/57d8ec24da59db5c6e614029b7150e0921bbc14e.png)

Then, I dropped a power chart tool as shown in the video and tried to plot "ambient\_temperature" but it did not show any lines.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/2/32fce36fbb97eca5d710052f2b4e3d17358d1978.png)

I checked the pen settings on the power chart and a pen was added. The tag path under the pen settings was displayed as:

"histprov:ManReadTestTable:/table:manreadtesttable:/column:ambient\_temperature"

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/3/f31a59ab51ada704c24c09e09e01fce5c84e5ea5.png)

I was hoping the database would recognize "t\_stamp" as the default timestamp associated with the record as explained in the video but it did not. I am not sure why.

I edited the tag path as shown below and still had no luck. "histprov:ManReadTestTable:/table:manreadtesttable:/column:ambient\_temperature:/timestamp:t\_stamp"

Any idea what am I doing wrong?

---

<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:** [April 2, 2024, 12:01am UTC](https://forum.inductiveautomation.com/t/tags-not-storing-if-value-is-not-changing/88141/6 "2024-04-02T00:01:17Z")

</div>

Don't use a bigint timestamp. Use column type `timestamptz` (timezone-aware timestamp). That yields timezone-aware values in Ignition when queried.
