AnsweredAssumed Answered

Is there a better way to get multiple values Uisng AFSummaryTypes

Question asked by goldymanikoth on Jun 9, 2017
Latest reply on Jun 12, 2017 by gregor

Is there a better way to get the Start and End value along with Summary( AFSummaryTypes.Maximum | AFSummaryTypes.Minimum | AFSummaryTypes.Average) ? I have to call InterpolatedValue two times to get both Initial and final readings! please help.

below is my sample code.

                     var summarizedvals = pivalue.Result.Summary(new AFTimeRange("00:00", "01:00"), AFSummaryTypes.Maximum | AFSummaryTypes.Minimum | AFSummaryTypes.Average, AFCalculationBasis.EventWeighted, AFTimestampCalculation.Auto);                       


                        //this can be eliminated  if i get  the values using summarizedvals itself

                          var initialVal = pivalue.Result.InterpolatedValue(new AFTime("00:00"));// pivalue.Result.RecordedValue(new AFTime("00:00"), AFRetrievalMode.Exact);

                         var finalVal = pivalue.Result.InterpolatedValue(new AFTime("01:00"));//pivalue.Result.RecordedValue(new AFTime("20:00"), AFRetrievalMode.Exact);

                        Console.WriteLine("Initial: " + initialVal.Value);

                        Console.WriteLine("Final: " + finalVal.Value);


                        Console.WriteLine("Average: " + summarizedvals[AFSummaryTypes.Average].Value);

                        Console.WriteLine("Max: " + summarizedvals[AFSummaryTypes.Maximum].Value);

                        Console.WriteLine("Min: " + summarizedvals[AFSummaryTypes.Minimum].Value);



Thanks in advance.