cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

how is tag history stored/displayed?

Solved!
Go to solution
Highlighted

how is tag history stored/displayed?

Im trying to understand a behavior I'm seeing. I have a tag for which I've enabled history. When I open the tag page, I can clearly see exactly at what time I opened the screen because suddenly the tag history gets a lot more dense:

tag hist.PNG

is this just a question of how its displayed (prior data is decimated?). I tried exporting the data to a CSV and it looks like all the data is there, but its just not viewable. Is there a way to view all of it?

 

Also some related points of feedback if you havent heard these yet:

-Timestamp in the graph if you hover over a bullet is displayed as 6.37e+10 which is...not helpful

-Exporting to CSV cuts off subsecond data. This probably won't be a big deal with more tags since I'll slow it down, but not being able to see the dT between two samples using the web tool is unfortunate.

0 Kudos
Message 1 of 13
(428 Views)
Solution
Accepted by topic author smithed
07-02-2018 10:16 AM

Re: how is tag history stored/displayed?

When the tag history view loads it retrieves a 1000 decimated values over the history of your tag to allow it to load quickly and for you to see a preview of what has happened in the past.

 

Once it loads the historical data, it then subscribes to any tag updates, and we show everything else that comes.  We figured it didn't make sense to toss out data that didn't match your original decimation, which is why it looks a bit different.

 

In the future, we hope to hook into the zoom events to allow the web UI to update the decimated data for a given range as you zoom it to see higher resolution information.  However, the tag historian service never returns more than 1 sample per second bucket for a given tag when returning decimated data, so we recommend publishing data 1Hz or slower.

 

We do have an API for retrieving all of the data over a given range, however our web UI doesn't plan to leverage it since we lose the ability to limit the request size.  Your can of course use it in any customer user interfaces you create.

Message 2 of 13
(390 Views)

Re: how is tag history stored/displayed?

Hi,


How can this tag history be displayed in a dashboard? And then add newly received values after the initial history data, just like the tag viewer does? Just found the property on the chart indicator Smiley Wink

 

Can you point me to the API that allows me to retrieve tag history data?

 

Thanks.

Regards,
André (CLA, CLED)
0 Kudos
Message 3 of 13
(246 Views)

Re: how is tag history stored/displayed?

 

Sorry it took so long to respond to this. The only API we have available to retrieve tag history is the HTTP API. 

I've included the API documentation you'll need below:

 

POST - http://<SERVER_NAME>/nitaghistorian/v1/tags/query-history

Body: 

{
"paths": [<TAG_PATH>]",
"startTime" : "<START_DATE>",
"endTime": "<END_DATE>"
}

You'll want to make sure that your 'startTime' and 'endTime' are ISO 8601 date strings. If it's easier for you, I can provide a LabVIEW VI that performs the call as well. Let me know if you prefer that.

-----------------------------------------------
Brandon Grey | AST & SystemLink PSE
Certified LabVIEW Architect

Message 4 of 13
(218 Views)

Re: how is tag history stored/displayed?

An example VI is always welcome.

Regards,
André (CLA, CLED)
0 Kudos
Message 5 of 13
(208 Views)

Re: how is tag history stored/displayed?

Attached. You'll need to change the server information, username, and password. 

-----------------------------------------------
Brandon Grey | AST & SystemLink PSE
Certified LabVIEW Architect

0 Kudos
Message 6 of 13
(205 Views)

Re: how is tag history stored/displayed?

1. Why does the "https://<server name>/nitaghistorian/v1/tags/query-history" call require "Modify and delete historical tag values".

2. When does this API get public, as in described in "https://<server name>/niapis"?

 

It seems to be a bug to me, as it would make more sense that it would only require "Query historical tag values and properties" access.

 

Please confirm if this is intended or a bug.

Regards,
André (CLA, CLED)
0 Kudos
Message 7 of 13
(60 Views)

Re: how is tag history stored/displayed?

Additional comment:

3. The return body of this web service call doesn't map well to unflatten JSON, because the tag name is used as name of the array containing the values. This would mean that I would need a constant with this name already set, I don't see how to do this dynamically. When requesting 2 historical data of 2 tags it seems to add an extra array to the JSON string.

 

EDIT: I just went through the JSON in example in CG and understand now how to access and convert the data using the paths input.

 

Is there any time line to a more use-able version of this call? 

Regards,
André (CLA, CLED)
0 Kudos
Message 8 of 13
(58 Views)

Re: how is tag history stored/displayed?

I haven’t seen the return myself so it may be easy enough using the built in serializer, but in general I’d strongly recommend using jsontext from the tools network:

sine.ni.com/nips/cds/view/p/lang/en/nid/216651

Its a library geared specifically towards the string manipulation of Json — for example, from this object list me all the tokens, or split this json array up into elements, regardless of the type of those elements. It’s not as fast as the built in version, but it’s nicer. And it can handle null characters in strings which is nice.

0 Kudos
Message 9 of 13
(52 Views)

Re: how is tag history stored/displayed?

Thanks for thinking with me.

 

I hope though that you are aware that I am talking about webVIs in NXG?

The toolkit you describe is for CG and uses functionality that is unavailable in NXG webVIs.

Regards,
André (CLA, CLED)
0 Kudos
Message 10 of 13
(46 Views)