AFAnalysisRule.CollectElements Method
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
This method collects the elements that are active for the current case.
Namespace: OSIsoft.AF.Analysis
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public virtual bool CollectElements()
Public Overridable Function CollectElements As Boolean Dim instance As AFAnalysisRule Dim returnValue As Boolean returnValue = instance.CollectElements()
public: virtual bool CollectElements()
abstract CollectElements : unit -> bool override CollectElements : unit -> bool
Return Value
Type: BooleanReturns if the operation was successful. Any messages generated during the collection process will be output using AFTrace.
Remarks
The default implementation uses the IsActiveElement(AFElement) method to determine which elements are active for the AFCase. The analysis rule is able to override this method and implement a different criteria for determining active elements. When overriding this method, use the AddElement protected method to add elements to the case's Elements collection.
The case's Elements collection is already cleared and is ready for the Analysis Rule to add back the active elements.