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

AF SDK Reference

AFDataReference.CreateConfig Method

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFDataReference.CreateConfig Method
This method is invoked by the user to update the attribute configuration relative to a foreign system.

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

Syntax

public virtual void CreateConfig()
Public Overridable Sub CreateConfig

Dim instance As AFDataReference

instance.CreateConfig()
public:
virtual void CreateConfig()
abstract CreateConfig : unit -> unit 
override CreateConfig : unit -> unit 

Remarks

This method is invoked by the user to allow the external data reference a mechanism to perform configuration operations and save that information into the foreign system, or back into the data reference arguments for the attribute. For example, it might store a recordID of a created database record to store data for this attribute.

Examples

// This example demonstrates how to create the DataReference configuration
// for all attributes with a PIPoint DataReference.

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

// Create an Element with an Attribute
AFElement myElement = myDB.Elements.Add("MyElement*");
AFAttribute myAttribute = myElement.Attributes.Add("MyAttribute");
myAttribute.DefaultUOM = myPISystem.UOMDatabase.UOMs["kelvin"];
myAttribute.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem);

// An example of a valid configuration string:
// "\\%Server%\sinusoid;ptclassname=classic;pointtype=Float32;pointsource=R;descriptor=""12 Hour Sine Wave"";location2=2;location4=1"
myAttribute.ConfigString = myConfigString;

// Create DataReference Configuration
foreach (AFAttribute CurAttribute in myElement.Attributes)
{
    CurAttribute.DataReference.CreateConfig();
}
' This example demonstrates how to create the DataReference configuration
' for all attributes with a PIPoint DataReference.

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

' Create an Element with an Attribute
Dim myElement As AFElement = myDB.Elements.Add("MyElement*")
Dim CurAttribute As AFAttribute = myElement.Attributes.Add("MyAttribute")
CurAttribute.DefaultUOM = myPISystem.UOMDatabase.UOMs("kelvin")
CurAttribute.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem)

' An example of a valid configuration string:
' "\\%Server%\sinusoid;ptclassname=classic;pointtype=Float32;pointsource=R;descriptor=""12 Hour Sine Wave"";location2=2;location4=1"
CurAttribute.ConfigString = myConfigString

' Display Attribute Information
For Each CurAttribute In myElement.Attributes
    CurAttribute.DataReference.CreateConfig()
Next CurAttribute

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
TitleResults for “How to create a CRG?”Also Available in