Tags not storing if value is not changing


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:


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:

Thank you

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.

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

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.

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

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

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

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:

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:


Here is how the "AddTestDataLog" query is setup:

I have the following records in my postgresSQL database so far:

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.

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


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?

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