AnsweredAssumed Answered

AFCalculation

Question asked by aljovinj on Mar 28, 2018
Latest reply on Apr 3, 2018 by aljovinj

Hi everyone, I'm trying to get the value of the summary per hour of this expression 'PK4.Actividad' > 0 in PI AF SDK but  I've get this message:

 

An unhandled exception of type 'System.InvalidOperationException' occurred in OSIsoft.AFSDK.dll Additional information: Unrecognized variable 'PK4.Actividad' in expression.

 

This expression works in DataLink, the code that I've used is:                

 

Dim lo_TimeStart As Time.AFTime = CType(DateTimePicker1.Value.ToShortDateString, Date).ToUniversalTime                 
Dim lo_timeRange As Time.AFTimeRange = New Time.AFTimeRange(lo_TimeStart, lo_TimeStart.LocalTime.AddDays(1))                 
Dim ls_expression As String = String.Format(Globalization.CultureInfo.InvariantCulture, "'PK4.Actividad'>0", MDIParent1.lo_PIAFSystem.Name)                 

Dim lo_returnvalue As IDictionary(Of AFSummaryTypes, AFValues) = AFCalculation.CalculateSummaries(MDIParent1.lo_PIAFSystem,
    ls_expression,
    lo_timeRange,
    Time.AFTimeSpan.Parse("1h"),
    AFSummaryTypes.Total, 
    AFCalculationBasis.TimeWeighted, 
    AFSampleType.Interval, 
    Time.AFTimeSpan.Parse("10m"),
    AFTimestampCalculation.Auto) 
               
Dim xx As AFValues = lo_returnvalue.Values(0)                 
For Each yy As AFValue In xx                     
    MsgBox(yy.Timestamp.ToString & " " & yy.Value.ToString)                 
Next 

 

Could anyone give me an idea to solve this?

Outcomes