AnsweredAssumed Answered

Filter expression usage in AF SDK

Question asked by mikhail.ten.seic on Apr 2, 2018
Latest reply on Apr 5, 2018 by mikhail.ten.seic

Hi everyone,


I am trying to filter values using filter expressions and it gives me error (below)

I use it like this:


AFValues values = attr.Data.RecordedValues(new AFTimeRange(af_st, af_et), AFBoundaryType.Inside, attr.DefaultUOM, filter, false);

It gives me 1 AFValue with the following content:

Expressions cannot use attributes with non-PI Data References in Attribute '\\COLLECTIVE\TAGNAME'.

   at OSIsoft.AF.Data.AFCalculation.ConvertVariable(Object sourceTarget, Object& destinationTarget, String variable, Boolean variableRequired, Boolean useDataReferenceSyntax, Boolean& autoDeterminePIServer)

   at OSIsoft.AF.Data.AFCalculation.ConvertExpressionTargetInternal(Object sourceTarget, Object& destinationTarget, String expression, Boolean useDataReferenceSyntax, Boolean autoDeterminePIServer)

   at OSIsoft.AF.Data.AFCalculation.ConvertFilterTarget(Object sourceTarget, Object destinationTarget, String expression)

   at OSIsoft.AF.Asset.DataReference.PIPointDR.RecordedValues(AFTimeRange timeRange, AFBoundaryType boundaryType, String filterExpression, Boolean includeFilteredValues, AFAttributeList inputAttributes, AFValues[] inputValues, List`1 inputTimes, Int32 maxCount)

   at OSIsoft.AF.Data.RecordedValuesQuery.QuerySourceDataReference(AFAttribute attribute, AFDataReference dataReference, AFDataProvider inputProvider, UOM desiredUOM)

   at OSIsoft.AF.Data.AFDataCaller`1.SyncCaller.ExecuteQuery(IAFDataReferenceQuery`1 query, AFAttribute attribute, AFDataReference dataReference, AFDataProvider inputProvider, UOM desiredUOM)


When I do not use filter it shows correct results. Moreover the same code is working on another web server, but on my server it is not.

AFSDK version:

.Net: 4.5.2