What is the simple way to modify a piece of data from basically an hour ago in a historian tag?
Is it to use the MSQL query techniques from those videos?
Or are there separate rules for historized tags?
edit: the solution on how to sort of surgically go in and change one value in the historian tag was provided and appreciated, then I realized that I actually need to do this update 3 times a day, so I revised to unsolved though technically the first inquiry was solved.
like data?
i.e. a 0.1 to a 1.1? if your attempt is as simple as that, you can always write and UPDATE query statement.
If your attempt to change data is deeper, like changing from an int value to a double value, a cell updates needs to be done and all data must be from the same type.
You can always check if trying to understand db tables Ignition Auto-Generated SQL Tables - Ignition User Manual 8.0 - Ignition Documentation (inductiveautomation.com)
If your tag is using “Analog” deadband style, then a simple update may not be enough. That style saves to the database using an algorithm that depends on the previous points saved. The line is reconstructed on query with the assumptions about how adjacent points are related. Modifying a data point without re-evaluating and possibly inserting more data is likely to throw off queries around the modified point.
Good point. As far as I know, the algorithm you mention is used to deploy data and perform interpolations and things like that.
However for storing, it will be stored based on the sample mode.
But I totally agree that INSERT should not be done under any circumstance.
The OP wants to modify history. A single UPDATE of a value that is using analog deadband mode will change the slope of interpolation on both sides of that point, not just for the period following. And may result in query returns that cannot happen naturally.
Thanks, we are using auto mode I found out. I am going to recommended a switch to discrete.
Shared the link to this post.
If I understand correctly, you are saying that if I use insert, it adds the row and will keep the analog interpolation smooth.
If it is discrete, using an update to modify the desired cell is best since discrete doesn’t have the interpolation.
This particular cell is just like a user comments at the wrap up of a timed event.
This row’s timestamps is periodic, and this one happens at the same time daily.
No, I'm saying that you may need an insert along with the update to keep the interpolation consistent. You'll have to do the math to determine this on a case by case basis.
It is best to determine what is causing the problem with the original recording and fix it there.
How do I UPDATE the value of the historian tag at 3pm yesterday?
Data is in sql_data_x_x_x
I don’t know how to specify the where condition to update the value.
I think I need like:
Update
sqlt_data_x_x_x(tablename I have to get the month and point at the sqlt data with that date)
set
comment(column name) = string (whatever I bind or parameter)
where
(this is the part I have no clue about)
How do I sanitize user comments for entry into my database to show on reports?
please correct me if I am wrong or a simpler way exists
I think I need to do this differently.
The sqlt_data_x_x_x table tstamp is to squirrelly for me to work with.
I shall make a table of year, month, day of month, shift, and comment.
Then when they make a comment, I do an insert to the db.
I need a script to call the query
param1= system.date.getyear
param2= system.date.getmonth
param3= system.date.getdayofmonth
param4=shifttag (set on the page I am making)
param5=comment (also a tag set on the page I am making
params ={param1,param2,param3,param4,param5}
system.db.runNamedQuery(“Project Name”, “queryname”, params)
example query
insert into tablename
(year, month, dayofmonth, shift, comment)
values
(yearparam,monthparam,dayofmonthparam,shiftparam,commentparam)
Then when I go to my report
I do another query?
Is the syntax right, or are those quotes not supposed to be in there?
insert into testtable
(year, month, dayofmonth, shift, comment)
values
(:year,:month,:dayofmonth,:shift,:comment)
the script portion is saying something like input mismatch expecting dedent, there is an issue with the path to those tags I think
Not sure how to remedy
update- I had a couple syntax errors like not using the [" "] setting my path
and then my indentation was wrong in the script.
now it doesn’t work and it doesn’t throw an error