AnsweredAssumed Answered

Getting Plotdata with filter expression

Question asked by Jagan on Sep 21, 2017
Latest reply on Sep 23, 2017 by Jagan

This is about how to get the data to plot in most quickest/efficient way in two cases. One without any filter expressions and one with filter expression. Suggestions welcome. Here the accuracy of data is less important. What is important is to get the data in shortest possible time.

 

-------------------

Case1:

Without any filter expression

//String path = “temperature”;

//Get context from path

//AFContext context

//AFTimeRange timeRange

//UOM desiredUOM

Int Intervals = 200;

AFValues afValuesForPlottingCurve =  context.Attribute.Data.PlotValues(timeRange, Intervals, desiredUOM)

afValuesForPlottingCurve are only used to show a plot on the screen. Is there any better/faster way to fetch the data?

-------------------

Case2:

With filter expression the logic to get values for plotting curve has been this

 

String filterExpression = “temperature > 20 “;

AFValues afValuesForPlottingCurve =  =  context.Attribute.Data.RecordedValues(timeRange, AFBoundaryType.Interpolated, desiredUOM, filterExpression, true)

AFValues  finalResutlForPlotting = afValuesForPlottingCurve.PlotValues(timeRange, Intervals);

 

The disadvantage of this has been Case2 has been

A. If timeRange is for longer duration say more than a year and if the data point has lot of values say 500 thousand+ values then only one value is returned with status: Event collection exceeded the maximum allowed

B. Even if maximum limit is not exceeded this logic is trying to get/load lot of data here. Is there any better way to do this? possible to use PlotValues() along with filter expression?

C. The data point on which this logic is applied are completely different from one another. Some might have data for every second, while some have data only once in 5 minutes. Also the time range differs for every call. Time range could be just 1 hour or it could also be 1 year. So should the logic to get data be changing based on amount of data present inside data point and based on the time range?

-------------------

Thanks,

Jagan 

Outcomes