AFCalculation.ConvertExpressionTarget Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Convert a Performance Equation (PE) Expression from one target to another.
Namespace: OSIsoft.AF.Data
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static string ConvertExpressionTarget( Object sourceTarget, Object destinationTarget, string expression )
Public Shared Function ConvertExpressionTarget ( sourceTarget As Object, destinationTarget As Object, expression As String ) As String Dim sourceTarget As Object Dim destinationTarget As Object Dim expression As String Dim returnValue As String returnValue = AFCalculation.ConvertExpressionTarget(sourceTarget, destinationTarget, expression)
public: static String^ ConvertExpressionTarget( Object^ sourceTarget, Object^ destinationTarget, String^ expression )
static member ConvertExpressionTarget : sourceTarget : Object * destinationTarget : Object * expression : string -> string
Parameters
- sourceTarget
- Type: SystemObject
The target that the expression was written against. This may be an AFAttribute, AFElement, or PIServer. If , the expression must be written using full path references. - destinationTarget
- Type: SystemObject
The destination target of an expression. This may be an AFAttribute, AFElement, or PIServer. If no destination target is specified, the expression will be converted into the first PIServer found in the expression. - expression
- Type: SystemString
The expression to convert.
Return Value
Type: StringThe converted expression.
Remarks
This routine will convert AF references within an expression that is written relative to one object (typically an AFElement),
to another (typically a PIServer or an AFAttribute). Currently, the PI Data Archive is used to evaluate expressions.
Because of this, the expression cannot contain points from multiple servers, nor use data references other than the PI Point Data Reference.
PI Point Data Reference configurations must be 'simple' - i.e, not configured with time or time range methods, summaries,
or perform UOM conversions.
This routine differs from ConvertFilterTarget(Object, Object, String) in that references from an attribute to
other attributes are assumed to be to the child attributes of the target.
For example, if an element contains two attributes, A1 and A2, then a reference from
target A1 to attribute A2 is written as "..|A2" ("|A2" is also possible).
A reference to a child attribute B1 of A1, is written simply as "B1" (although ".|B1" is also possible).