Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFCase.CollectElements Method

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFCase.CollectElements Method
This method collects the elements that are active for this case.

Namespace:  OSIsoft.AF.Analysis
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public bool CollectElements()
Public Function CollectElements As Boolean

Dim instance As AFCase
Dim returnValue As Boolean

returnValue = instance.CollectElements()
public:
bool CollectElements()
member CollectElements : unit -> bool 

Return Value

Type: Boolean
Returns if the operation was successful. Any messages generated during the collection process will be output using AFTrace.

Remarks

The AFAnalysisRule used by this method is defined by the AFAnalysis that owns this case. The analysis rule's CollectElements method is used to determine which elements to add to the Elements collection. The default implementation uses the IsActiveElement(AFElement) to determine which of the elements in the model are active for the case. This method is automatically called when the case is created. The Elements collection is reset back to its original collection and any previous additions and/or deletions from the collection are lost. The CollectTransfers method must be called to add transfers back to the collection.

This method updates the CollectElementsTime and CollectTransfersTime properties. If there are no errors, the CollectElementsTime will be set to the current time. If an error occurs, the time will be set to AFTime.MinValue to indicate that elements have not been successfully collected. The CollectTransfersTime will be set to AFTime.MinValue to indicate that transfers have not been collected.

The Before event is raised before this operation is started to allow clients an opportunity to perform any required validation or processing before starting the operation. The operation can also be canceled by setting the Cancel property of the AFCaseCancelEventArgs parameter to the event. The Executing event is raised during the execution of the operation to allow clients an opportunity to cancel and not wait for the operation to complete. The After event is raised after the operation is completed to allow clients an opportunity to perform any post-processing.

Security note Security Note
You must have Execute security rights to collect elements for a case.

Version Information

AFSDK


See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in