Get most recent previous value for a PI Tag

Discussion created by pramod.gupta on Feb 7, 2012
Latest reply on Feb 7, 2012 by MvanderVeeken

Hello Guys,


Currently i am getting the PIValues for a certain time range using following method:


        public PIValues GetRecordedValues(string piServerName, string piPointName, string startTime, string endTime)
            PIValues pivalues = null;
            PIPoint piPoint = null;
            PISDKCommon.PIAsynchStatus async = null;
            FilteredViewConstants filtered = FilteredViewConstants.fvShowFilteredState;
            Server piServer = null;


                piServer = PISDK.Servers[piServerName];
                piPoint = piServer.PIPoints[piPointName];
                pivalues = piPoint.Data.RecordedValues(startTime, endTime, BoundaryTypeConstants.btInside,"", filtered, async);


            catch(Exception ex)
                Debug.WriteLine("UtilityPISDK.GetRecordedValues(): " + ex.Message);
                Debug.WriteLine(string.Format("PI Server: {0}, PointName: {1}", piServer, piPointName));


            return pivalues;




But now The task  is to change the method so that when data does not appear within the requested range, it should return the most recent previous value.


Please help me in this issue.