AFAnalysis.SetStatus Method (AFDatabase, AFObject, AFStatus, AFStatus)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Sets all the analyses based upon a filter object to the specified status.
Namespace: OSIsoft.AF.Analysis
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static void SetStatus( AFDatabase database, AFObject filter, AFStatus newStatus, AFStatus oldStatus = AFStatus.None )
Public Shared Sub SetStatus ( database As AFDatabase, filter As AFObject, newStatus As AFStatus, Optional oldStatus As AFStatus = AFStatus.None ) Dim database As AFDatabase Dim filter As AFObject Dim newStatus As AFStatus Dim oldStatus As AFStatus AFAnalysis.SetStatus(database, filter, newStatus, oldStatus)
public: static void SetStatus( AFDatabase^ database, AFObject^ filter, AFStatus newStatus, AFStatus oldStatus = AFStatus::None )
static member SetStatus : database : AFDatabase * filter : AFObject * newStatus : AFStatus * ?oldStatus : AFStatus (* Defaults: let _oldStatus = defaultArg oldStatus AFStatus.None *) -> unit
Parameters
- database
- Type: OSIsoft.AFAFDatabase
The AFDatabase to search for the requested objects. - filter
- Type: OSIsoft.AFAFObject
The object to be used to filter the analyses to have their Status set to the specified newStatus value. Specify to set the status for all analyses within the database. The filtered analyses can be limited by the oldStatus parameter if specified.
The following types of filter objects can be specified:
Object Type Description AFAnalysisTemplate The status for all analyses with the specified template will be set. Specify None as the filter for analyses with no template. AFCategory The status for all analyses with the specified category will be set. Specify None as the filter for analyses with no categories. - newStatus
- Type: OSIsoft.AF.AnalysisAFStatus
The new AFStatus for the analyses. - oldStatus (Optional)
- Type: OSIsoft.AF.AnalysisAFStatus
The old AFStatus for the analyses that are to be updated. Only analyses with the specified old status will be updated. To update all analyses not having the newStatus, then specify None for this parameter.
Exceptions
| Exception | Condition |
|---|---|
| NotSupportedException | This exception is thrown when calling this method and connected to an AF 2.6 or earlier server or if an unsupported filter is specified. |
Remarks
This method will set all the analyses based upon a filter object to the same AFStatus in a single
call to the server. If the optional oldStatus is specified, then only analyses that match the
old status will be updated.
This is more efficient than setting the Status property of each analysis.