cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Extracting Date Created of an xMII Cache

Former Member
0 Kudos
149

In a web page, I want to be able to display whether or not the iChart applet is displaying data from an xMII cache or not. If it is from a cache, I also want to display when the cache was created, i.e. how old the data is.

Does anyone know how to get this info out of an xMII applet using client side java script? Didn't see anything in the Script Assistant.

Thanks,

Bill

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Jeremy,

That was my thought on the Start/End Dates, however my duration on that query template is set to 0 seconds. So not sure what's going on there. Also those dates are such that it appears the local server time is being taken as GMT time and then being adjusted, explaining the +10 hours on the EndTime??? The server is definitely set to Brisbane in Windows.

Anyway, I now have enough insight to pursue my original thought if I want. If the DateCreated stayed at the original datetime, that would be the easiest. I'll raise it with support and see what they say. Meanwhile, we have learned to use the caching to great advantage and it's working well. Once Jamie informed me of the Trace param in the applet, I had the tools to make sure the execute calls matched exactly.

Thanks for your help guys,

Bill

jcgood25
Active Contributor
0 Kudos

Bill,

A duration of 0 is really not valid (I think having a TimePeriod set at one time may do this to a query template) since the StartDate and EndDate values must be at least one second apart, so the query time engine will default back to 60 seconds as a baseline.

I'm also glad to hear that you've been leveraging the query caching in your applications, and I'll see it in action in a few weeks in Melbourne.

Regards,

Jeremy

Former Member
0 Kudos

Rick,

It's an Xacute query template, not an SQL query. I could do my own caching logic, (and we used to do that until I finaly discovered how to cache an Xacute query thanks to a one sentence response from you in a thread some time ago), but we really want to use the out of the box xMII caching.

If you think the DateCreated should be staying the original date, I'll raise an issue on it. Any thoughts on the Start/End Dates?

Bill

Former Member
0 Kudos

Rick,

I take it you're refering to the following:

<Rowsets DateCreated="2007-10-16T10:04:38" EndDate="2007-10-16T20:02:26" StartDate="2007-10-16T19:02:26" Version="11.5.3">

I tested it using the Test button on the Query Template. The tests after the first are obviously coming from the cache because of the speed. But the DateCreated changes to represent the fetched time, not the original create time.

However the EndDate / StartDate remain the same, and the EndDate seems to be when the original test was done. But the EndDate is 10 hours ahead, and the StartDate is 1 hour behind the EndDate?? There is nothing set on the Date Range tab, and the Start / End Dates are not mapped (or else the thing won't cache). The StartDate and EndDate showing seem to have no relation to anything, except they are 9 and 10 hours ahead of the creation datetime. The only thing I can think of is Brisbane is GMT +10.

If I can make sense of those 2 dates, I might be able to use them.

Thanks,

Bill

Former Member
0 Kudos

Sounds like a bug with the DateCreated being updated...I'd suggest reporting it.

Former Member
0 Kudos

With a small bit of work, you could modify your app to use BLS to do the query, instead of a cached SQL query template. In that case, you could put the caching logic in the BLS logic (see if a cached version exists, if it does, load it and check the date, if out of date, reload it, otherwise return it). You could also play some tricks with the XML to add a "<Messages><Message>XXX</Message></Messages>" set of children to the <Rowsets> element, which would be propagated to the applets (at least it would be displayed in the Java console, and might be available via an applet method).

jcgood25
Active Contributor
0 Kudos

Bill,

If your server is physically in Brisbane (or at least the timezone is set that way), the EndDate of a query that has no date related settings will always be the current timestamp on the xMII server at the time of query execution, and with a Duration=60 / DurationUnits=M the StartDate will be one hour prior to the end date. This is what you are seeing with the dates of the query, and is the default behavior of the query time engine (if the duration was 120 you would see a StartDate 2 hours prior to the EndDate).

Regards,

Jeremy

Former Member
0 Kudos

Not easily, Bill. The applets do not receive this data as part of their "streaming" protocol, and therefore don't have an accessor to get at it. However, if you add a little bit of "AJAX magic", you can probably do a URL request to get the same dataset that your applet is viewing as an XML document, and there is an attribute on the Rowsets element that represents the creation date (which should be when the original data was queried), but you'd have to try it to verify.

Rick