AlistairFrith

AFAttribute GetValue() inconsistent return set

Discussion created by AlistairFrith on Jun 11, 2013
Latest reply on Jun 12, 2013 by Gregor

I have the following code:

 
        public override DataTable CalculateDetailDR(DataTable detailDT, AFElement targetElement, DateTime m_start, DateTime m_end)
        {
            string context = targetElement.GetPath();

            // Get source data for each KPI
            AFAttribute kpisAttribute = targetElement.Attributes["KPIs"];
            AFAttribute airTempAttribute = kpisAttribute.Attributes["Air Temp"];
            AFAttribute utilisationAttribute = kpisAttribute.Attributes["Utilisation"];

            AFTimeRange timeRange = new AFTimeRange(m_start.ToLocalTime().ToString(), m_end.ToLocalTime().ToString());
            PIValues airTempPIValues = airTempAttribute.GetValues(timeRange, 0, null).ToPIValues() as PIValues;
            PIValues utilisationPIValues = utilisationAttribute.GetValues(timeRange, 0, null).ToPIValues() as PIValues;

            // Calculate summaries for each KPI
            PITime firstTime = ReportingCalculations.TimestampOfFirst(airTempPIValues);
            PITime lastTime = ReportingCalculations.TimestampOfLast(airTempPIValues);

            ...

I have an error further down the code and so am trying to debug it. The problem is that sometimes GetValues() returns 20 or 30 values (correctly) and other times returns 2 values of 'Arc Offline' when looking at the same asset and the same time range!

 

Has anyone else seen this?

 

--- Alistair

Outcomes