Rewriting or overwriting tag history

We're interacting with an API from our energy supplier.
With this API we get historical energy use data and I use the storeTagHistory function to write this info in our historian.

This works perfectly and we can create reports and trends etc.
However, our supplier informed us that some relatively recent (few days old) data can be changed later on for whatever reason, it could be there is also a gap in the data due to a network error in the supplier network. With this in mind it is best to retrieve the data of the previous month after a week or so and overwrite this in the historian.

We also get a validation and quality status with all datapoints and at the moment we do not write those specific datapoints with validation or quality issue's.

As far as I can see at the moment the only way to alter history data is to delete the tag, recreate it and re-fill it with data. and if there would be data with validation or quality issue's and thus gaps in our data we would have to periodically recheck if there were gaps and re-retrieve the data for those gaps.

Is there a different way then the storeTagHistory to handle this scenario?

I could use 2 tags aswell, 1 for direct visuals that updates all the time but might not be 100% correct and another one that will only update after > 1 week has passed and only contains valid data. but if at all possible I'd like to avoid this kind of complexity.

Hi Stef,
I'm facing same challenge.
Have you found an approach please ?

I went with a different approach and stopped using the tag historian.
I'm just using a seperate Table and use SQL commands (INSERT / UPDATE)

Thanks for the update.

Do you mean that you are needing to go back and update historical data that has already been recorded?

If so, this is not possible first party as it is a violation of what is intended by 'Tag History'. As historical data that can be modified would no longer be a true representation of "what happened".

If what you need is just data storage, tag history is not an appropriate solution.

2 Likes

Hi Irose,
We noticed during project data tests that the impulse weights of some meters are not properly configured. We therefore have a few days or weeks with some values to correct... Yes for sure we can do everything in SQL scripting but with the historical partitionning, storeTagHistory with a overwrite option shall be nice :slight_smile:
Thx