AFAttributeSearch.FindAttributes Method
- Last UpdatedJan 12, 2026
- 4 minute read
- PI System
- AF SDK 3.2.0
- Developer
Note: This API is now obsolete.
This method will return the AFAttribute objects that match the
search tokens.
Namespace: OSIsoft.AF.Search
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.2.0.7
Syntax
[BrowsableAttribute(false)] [ObsoleteAttribute("This method has been replaced by FindObjects.")] public IEnumerable<AFAttribute> FindAttributes( int startIndex = 0, int pageSize = 0 )
<BrowsableAttribute(false)> <ObsoleteAttribute("This method has been replaced by FindObjects.")> Public Function FindAttributes ( Optional startIndex As Integer = 0, Optional pageSize As Integer = 0 ) As IEnumerable(Of AFAttribute) Dim instance As AFAttributeSearch Dim startIndex As Integer Dim pageSize As Integer Dim returnValue As IEnumerable(Of AFAttribute) returnValue = instance.FindAttributes(startIndex, pageSize)
public: [BrowsableAttribute(false)] [ObsoleteAttribute(L"This method has been replaced by FindObjects.")] IEnumerable<AFAttribute^>^ FindAttributes( int startIndex = 0, int pageSize = 0 )
[<BrowsableAttribute(false)>] [<ObsoleteAttribute("This method has been replaced by FindObjects.")>] member FindAttributes : ?startIndex : int * ?pageSize : int (* Defaults: let _startIndex = defaultArg startIndex 0 let _pageSize = defaultArg pageSize 0 *) -> IEnumerable<AFAttribute>
Parameters
- startIndex (Optional)
- Type: SystemInt32
The starting index (zero based) of the items to be returned. - pageSize (Optional)
- Type: SystemInt32
The page size used for retrieving objects from the server. If this parameter is less than or equal to zero, then the page size will be set to the current value of the CollectionPageSize setting.
Return Value
Type: IEnumerableAFAttributeReturns an enumerable list of the AFAttribute objects found using the search tokens for this search object.
Exceptions
| Exception | Condition |
|---|---|
| FormatException | This exception is thrown if the ThrowOnError property is and there is a format error in the search query. |
| NotSupportedException | This exception is thrown if the ThrowOnError property is and one of the filters is not supported or the query is too complex to be evaluated by the server. |
Remarks
This method will search for matching objects based upon the search tokens.
By default, attribute values with a data reference are evaluated using the QueryDate of the database.
The TimeContext search filter can be used to modify this behavior.
Examples
1// Get the Database 2PISystems myPISystems = new PISystems(); 3PISystem myPISystem = myPISystems.DefaultPISystem; 4if (myPISystem == null) 5 throw new InvalidOperationException("Default PISystem was not found."); 6AFDatabase myDB = myPISystem.Databases[dbName]; 7if (myDB == null) 8 throw new InvalidOperationException("Database was not found."); 9 10// Create a search to find the level of all TankElements. 11int count; 12using (var search = new AFAttributeSearch(myDB, "FindTankLevel", @"Element:{ Name:'TankElement*' } Name:'Level'")) 13{ 14 search.CacheTimeout = TimeSpan.FromMinutes(10); 15 16 count = search.GetTotalCount(); 17 Console.WriteLine("Found {0} Attributes.", count); 18 foreach (AFAttribute item in search.FindObjects()) 19 { 20 Console.WriteLine(" Element {0} has {1} Attributes", item.Name, item.Attributes.Count); 21 } 22}
Version Information
AFSDK
Supported in: 2.10.0, 2.10, 2.9.5Obsolete (compiler warning) in 3.1.1
Obsolete (compiler warning) in 3.1.0
Obsolete (compiler warning) in 3.0.2
Obsolete (compiler warning) in 3.0.1
Obsolete (compiler warning) in 3.0.0
Obsolete (compiler warning) in 2.10.11
Obsolete (compiler warning) in 2.10.5