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

AF SDK Reference

PIPoint.FindAttributeNames Method

  • Last UpdatedNov 18, 2025
  • 6 minute read
PIPoint.FindAttributeNames Method
Find the loaded PIPoint attribute names based upon a filter.

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

Syntax

public IEnumerable<string> FindAttributeNames(
	string nameFilter
)
Public Function FindAttributeNames ( 
	nameFilter As String
) As IEnumerable(Of String)

Dim instance As PIPoint
Dim nameFilter As String
Dim returnValue As IEnumerable(Of String)

returnValue = instance.FindAttributeNames(nameFilter)
public:
IEnumerable<String^>^ FindAttributeNames(
	String^ nameFilter
)
member FindAttributeNames : 
        nameFilter : string -> IEnumerable<string> 

Parameters

nameFilter
Type: SystemString
The filter to use for the list of PIPoint attribute names to be returned.

The query string (or match pattern) can include regular characters and wildcard characters. Regular characters must match exactly the characters specified in the query string. Wildcard characters can be matched with arbitrary fragments of the query string. Wildcard characters can be escaped using the single backslash (\) character. Use a double backslash (\\) to match a single backslash. The syntax of the query string has the following rules:

  • If or empty string, then everything will be matched.
  • If no wildcards, then an exact match on the query string is performed.
  • Wildcard * can be placed anywhere in the query string and matches zero or more characters.
  • Wildcard ? can be placed anywhere in the query string and matches exactly one character.
  • One character in a set of characters are matched by placing them within [ ]. For example, a[bc] would match 'ab' or 'ac', but it would not match 'ad' or 'abd'.
  • One character in a set of characters are not matched by placing them within [! ]. For example, a[!bc] would match 'ad', but it would not match 'ab', 'ac', or 'abd'.
  • A character in a range of characters from first to last are matched using the following syntax: [first - last]. For example, a[a-c] would match 'aa', 'ab', or 'ac', but it would not match 'ad' or 'abc'.

Return Value

Type: IEnumerableString
Returns a list of PIPoint attribute names based upon the specified filter.

Remarks

This method is used to find the list of attribute names for the PIPoint that have been loaded. If no attributes have been loaded, then the LoadAttributes(String) method will be called to get the list of all PIPoint attributes to search.

Examples

// This example demonstrates how to create an attribute for an
// element and retrieve and set PIPoint attributes.

// Get the Database
PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;
AFDatabase myDB = myPISystem.Databases.DefaultDatabase;

// Create an Element Template
AFElementTemplate myElemTemplate = myDB.ElementTemplates.Add("MyElementTemplate");
AFAttributeTemplate myAttrTemplate = myElemTemplate.AttributeTemplates.Add("Attr#1");
myAttrTemplate.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem);
myAttrTemplate.ConfigString = @"\\%Server%\%Element%;pointtype=Float64";

// Create an Element from the Element Template
AFElement myElement = myDB.Elements.Add("MyElement", myElemTemplate);

// Create the PIPoint for the Attribute
AFAttribute myAttribute = myElement.Attributes["Attr#1"];
myAttribute.DataReference.CreateConfig();

// Find all PIPoint Attributes and Display their values
object drAttrValue;
myAttribute.PIPoint.LoadAttributes();
IEnumerable<string> list = myAttribute.PIPoint.FindAttributeNames(null);
Console.WriteLine("Found PIPoint Attributes: nameFilter='<null>'");
foreach (string item in list)
{
    drAttrValue = myAttribute.PIPoint.GetAttribute(item);
    Console.WriteLine("  {0} = '{1}'", item, drAttrValue);
}
Console.WriteLine();

// Find PIPoint Attributes matching 'Ex*' and display their values
list = myAttribute.PIPoint.FindAttributeNames("Ex*");
Console.WriteLine("Found PIPoint Attributes: nameFilter='Ex*'");
int cnt = 0;
foreach (string item in list)
{
    cnt++;
    drAttrValue = myAttribute.PIPoint.GetAttribute(item);
    Console.WriteLine("  {0} = '{1}'", item, drAttrValue);
}
Console.WriteLine();

// Unload all PIPoint Attributes
myAttribute.PIPoint.UnloadAllAttributes();

// Load specific PIPoint Attributes and display their values
myAttribute.PIPoint.LoadAttributes(PICommonPointAttributes.PointType,
    PICommonPointAttributes.PointID,
    PICommonPointAttributes.Descriptor,
    PICommonPointAttributes.ExtendedDescriptor,
    PICommonPointAttributes.CreationDate);
drAttrValue = myAttribute.PIPoint.GetAttribute(PICommonPointAttributes.PointType);
Console.WriteLine("PIPoint Attribute '{0}' = '{1}'.", PICommonPointAttributes.PointType, drAttrValue);
drAttrValue = myAttribute.PIPoint.GetAttribute(PICommonPointAttributes.PointID);
Console.WriteLine("PIPoint Attribute '{0}' = '{1}'.", PICommonPointAttributes.PointID, drAttrValue);
drAttrValue = myAttribute.PIPoint.GetAttribute(PICommonPointAttributes.Descriptor);
Console.WriteLine("PIPoint Attribute '{0}' = '{1}'.", PICommonPointAttributes.Descriptor, drAttrValue);
drAttrValue = myAttribute.PIPoint.GetAttribute(PICommonPointAttributes.ExtendedDescriptor);
Console.WriteLine("PIPoint Attribute '{0}' = '{1}'.", PICommonPointAttributes.ExtendedDescriptor, drAttrValue);
drAttrValue = myAttribute.PIPoint.GetAttribute(PICommonPointAttributes.CreationDate);
Console.WriteLine("PIPoint Attribute '{0}' = '{1}'.", PICommonPointAttributes.CreationDate, drAttrValue);
Console.WriteLine();

// Set PIPoint Attribute value
string newAttrValue = "New Value: " + DateTime.Now.ToShortTimeString();
myAttribute.PIPoint.SetAttribute(PICommonPointAttributes.Descriptor, newAttrValue);
myAttribute.PIPoint.SetAttribute(PICommonPointAttributes.ExtendedDescriptor, newAttrValue);
AFErrors<string> errors = myAttribute.PIPoint.SaveAttributes(PICommonPointAttributes.Descriptor,
    PICommonPointAttributes.ExtendedDescriptor);
if (errors != null && errors.HasErrors)
{
    Console.WriteLine("Errors calling PIPoint.SaveAttributes:");
    foreach (var item in errors.Errors)
    {
        Console.WriteLine("  {0}: {1}", item.Key, item.Value);
    }
}
' This example demonstrates how to create an attribute for an
' element and retrieve and set PIPoint attributes.

' Get the Database
Dim myPISystems As PISystems = New PISystems
Dim myPISystem As PISystem = myPISystems.DefaultPISystem
Dim myDB As AFDatabase = myPISystem.Databases.DefaultDatabase

' Create an Element Template
Dim myElemTemplate As AFElementTemplate = myDB.ElementTemplates.Add("MyElementTemplate")
Dim myAttrTemplate As AFAttributeTemplate = myElemTemplate.AttributeTemplates.Add("Attr#1")
myAttrTemplate.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem)
myAttrTemplate.ConfigString = "\\%Server%\%Element%;pointtype=Float64"

' Create an Element from the Element Template
Dim myElement As AFElement = myDB.Elements.Add("MyElement", myElemTemplate)

' Create the PIPoint for the Attribute
Dim myAttribute As AFAttribute = myElement.Attributes("Attr#1")
myAttribute.DataReference.CreateConfig()

' Find all PIPoint Attributes and Display their values
Dim drAttrValue As Object
myAttribute.PIPoint.LoadAttributes()
Dim list As IEnumerable(Of String) = myAttribute.PIPoint.FindAttributeNames(Nothing)
Console.WriteLine("Found PIPoint Attributes: nameFilter='<null>'")
For Each item As String In list
    drAttrValue = myAttribute.PIPoint.GetAttribute(item)
    Console.WriteLine("  {0} = '{1}'", item, drAttrValue)
Next
Console.WriteLine()

' Find PIPoint Attributes matching 'Ex*' and display their values
list = myAttribute.PIPoint.FindAttributeNames("Ex*")
Console.WriteLine("Found PIPoint Attributes: nameFilter='Ex*'")
Dim cnt As Integer = 0
For Each item As String In list
    cnt = (cnt + 1)
    drAttrValue = myAttribute.PIPoint.GetAttribute(item)
    Console.WriteLine("  {0} = '{1}'", item, drAttrValue)
Next
Console.WriteLine()

' Unload all PIPoint Attributes
myAttribute.PIPoint.UnloadAllAttributes()

' Load specific PIPoint Attributes and display their values
myAttribute.PIPoint.LoadAttributes(PICommonPointAttributes.PointType,
                                   PICommonPointAttributes.PointID,
                                   PICommonPointAttributes.Descriptor,
                                   PICommonPointAttributes.ExtendedDescriptor,
                                   PICommonPointAttributes.CreationDate)
drAttrValue = myAttribute.PIPoint.GetAttribute(PICommonPointAttributes.PointType)
Console.WriteLine("PIPoint Attribute '{0}' = '{1}'.", PICommonPointAttributes.PointType, drAttrValue)
drAttrValue = myAttribute.PIPoint.GetAttribute(PICommonPointAttributes.PointID)
Console.WriteLine("PIPoint Attribute '{0}' = '{1}'.", PICommonPointAttributes.PointID, drAttrValue)
drAttrValue = myAttribute.PIPoint.GetAttribute(PICommonPointAttributes.Descriptor)
Console.WriteLine("PIPoint Attribute '{0}' = '{1}'.", PICommonPointAttributes.Descriptor, drAttrValue)
drAttrValue = myAttribute.PIPoint.GetAttribute(PICommonPointAttributes.ExtendedDescriptor)
Console.WriteLine("PIPoint Attribute '{0}' = '{1}'.", PICommonPointAttributes.ExtendedDescriptor, drAttrValue)
drAttrValue = myAttribute.PIPoint.GetAttribute(PICommonPointAttributes.CreationDate)
Console.WriteLine("PIPoint Attribute '{0}' = '{1}'.", PICommonPointAttributes.CreationDate, drAttrValue)
Console.WriteLine()

' Set PIPoint Attribute value
Dim newAttrValue As String = ("New Value: " + DateTime.Now.ToShortTimeString)
myAttribute.PIPoint.SetAttribute(PICommonPointAttributes.Descriptor, newAttrValue)
myAttribute.PIPoint.SetAttribute(PICommonPointAttributes.ExtendedDescriptor, newAttrValue)
Dim errors As AFErrors(Of String) = myAttribute.PIPoint.SaveAttributes(PICommonPointAttributes.Descriptor,
                                                                       PICommonPointAttributes.ExtendedDescriptor)
If errors IsNot Nothing AndAlso errors.HasErrors Then
    Console.WriteLine("Errors calling PIPoint.SaveAttributes:")
    For Each item As KeyValuePair(Of String, Exception) In errors.Errors
        Console.WriteLine("  {0}: {1}", item.Key, item.Value)
    Next
End If

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

Version Information

AFSDK


See Also

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