AnsweredAssumed Answered

How can I handle a call to GetValues in a custom DR?

Question asked by vincent.spaa on Feb 17, 2015
Latest reply on Feb 19, 2015 by vincent.spaa

I have a custom data reference which can handle a call to GetValue (i.e. a request for a single value) just fine.

But at some point the customer also wanted to trend the values so (from what I understand) support for a call to GetValues is then also required to make it work.

So I wrote a GetValues method like so:


public override AFValues GetValues(object context, AFTimeRange timeRange, int numberOfValues,
    AFAttributeList inputAttributes, AFValues[] inputValues)
    AFValues valuesCollection = new AFValues();
    DateTime start = timeRange.StartTime.LocalTime;
    start = new DateTime(start.Year, start.Month, start.Day, start.Hour, 0, 0, 0)
    DateTime end = timeRange.EndTime.LocalTime;
    end = new DateTime(end.Year, end.Month, end.Day, end.Hour, 0, 0, 0);

    while (start < end)
        start = start.AddHours(1);

    return valuesCollection;


Since the values only change every hour (at the exact hour) I figured I could work with increments of an hour.

However, when I try to trend the values from my custom DR, I do get a call to GetValues() but the timeRange stays the same. When I change the time range in Processbook, I still get a timeRange passed to GetValues which only spans 8 hours.

Even if I enter *-256h and * for the range in Processbook, I still get a value for timeRange which only spans 8 hours (from 8 hours ago until now).


Is there something I'm doing wrong?


This is how my Supported properties look like:


public override AFDataReferenceContext SupportedContexts
  get { return AFDataReferenceContext.All; }

public override AFDataReferenceMethod SupportedMethods
  return AFDataReferenceMethod.GetValue | AFDataReferenceMethod.GetValues;