Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Java
 QCRTGraph for Java
 RTProcessVar Historical information
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dldudley

10 Posts

Posted - 01 Jun 2010 :  10:49:20  Show Profile  Reply with Quote
Is there a way to get the number of historical data points currently stored by a process variable? I'm wondering if a particular variable is acquiring history information, so I'd like to display a count of the number of history elements stored.

quinncurtis

1586 Posts

Posted - 01 Jun 2010 :  11:13:24  Show Profile  Reply with Quote
int n = processvar1.getProcessVarDataset().getNumberDatapoints();
Go to Top of Page

dldudley

10 Posts

Posted - 01 Jun 2010 :  12:06:47  Show Profile  Reply with Quote
When I execute that statement, I get a java.lang.NulllPointerException. I probably haven't initialized my ProcessVar correctly. Do I have to tell the variable to accumulate historical information? I currently set and read the ProcessVar value through my realtime display, and I'm trying to add a Historical chart to the display using that same variable.
Go to Top of Page

dldudley

10 Posts

Posted - 01 Jun 2010 :  12:08:52  Show Profile  Reply with Quote
Should also say that I can do the getAutoTruncateDataset() and get false. Do I have to set the AutoTruncateMax and AutoTruncateMin counts to anything initially?
Go to Top of Page

quinncurtis

1586 Posts

Posted - 01 Jun 2010 :  12:57:53  Show Profile  Reply with Quote
You have to set the process variable to save historical data before you attempt to read the count of the historical data. That is done using the setDatasetEnableUpdate method, as seen in our scrolling examples. You don't have to set the AutoTruncateMin and Max values.

If you plan to check process variables that may have not been initialized for historical data yet, check for null first and return 0 in that case.

int n=0;
if (processvar1 != null)
  if (processvar1.getProcessVarDataset() != null)
    n = processvar1.getProcessVarDataset().getNumberDatapoints();

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07