// This example shows how to enumerate all properties of an OPC item. For each property, it displays its Id and description.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
class procedure BrowseProperties.Main;
var
Client: OpcLabs_EasyOpcClassic_TLB._EasyDAClient;
Count: Cardinal;
Element: OleVariant;
ServerDescriptor: _ServerDescriptor;
NodeDescriptor: _DANodeDescriptor;
PropertyElement: _DAPropertyElement;
PropertyElementEnumerator: IEnumVariant;
PropertyElements: _DAPropertyElementCollection;
begin
ServerDescriptor := CoServerDescriptor.Create;
ServerDescriptor.ServerClass := 'OPCLabs.KitServer.2';
NodeDescriptor := CoDANodeDescriptor.Create;
NodeDescriptor.ItemId := 'Simulation.Random';
// Instantiate the client object
Client := CoEasyDAClient.Create;
try
PropertyElements := Client.BrowseProperties(
ServerDescriptor,
NodeDescriptor);
except
on E: EOleException do
begin
WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
Exit;
end;
end;
PropertyElementEnumerator := PropertyElements.GetEnumerator;
while (PropertyElementEnumerator.Next(1, Element, Count) = S_OK) do
begin
PropertyElement := IUnknown(Element) as _DAPropertyElement;
WriteLn('PropertyElements("', PropertyElement.PropertyId.NumericalValue, '").Description: ', PropertyElement.Description);
end;
end;
// This example shows how to enumerate all properties of an OPC item. For each property, it displays its Id and description.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
$ServerDescriptor = new COM("OpcLabs.EasyOpc.ServerDescriptor");
$ServerDescriptor->ServerClass = "OPCLabs.KitServer.2";
$NodeDescriptor = new COM("OpcLabs.EasyOpc.DataAccess.DANodeDescriptor");
$NodeDescriptor->ItemID = "Simulation.Random";
$Client = new COM("OpcLabs.EasyOpc.DataAccess.EasyDAClient");
try
{
$PropertyElements = $Client->BrowseProperties($ServerDescriptor, $NodeDescriptor);
}
catch (com_exception $e)
{
printf("*** Failure: %s\n", $e->getMessage());
Exit();
}
foreach ($PropertyElements as $PropertyElement)
{
printf("PropertyElements(\"s\").Descriptions\n", $PropertyElement->PropertyID->NumericalValue, $PropertyElement->Description);
}
REM This example shows how to enumerate all properties of an OPC item. For each property, it displays its Id and description.
REM
REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Private Sub BrowseProperties_Main_Command_Click()
OutputText = ""
Dim serverDescriptor As New serverDescriptor
serverDescriptor.ServerClass = "OPCLabs.KitServer.2"
Dim nodeDescriptor As New DANodeDescriptor
nodeDescriptor.itemId = "Simulation.Random"
' Instantiate the client object
Dim client As New EasyDAClient
On Error Resume Next
Dim propertyElements As DAPropertyElementCollection
Set propertyElements = client.BrowseProperties(serverDescriptor, nodeDescriptor)
If Err.Number <> 0 Then
OutputText = OutputText & "*** Failure: " & Err.Source & ": " & Err.Description & vbCrLf
Exit Sub
End If
On Error GoTo 0
Dim propertyElement: For Each propertyElement In propertyElements
OutputText = OutputText & "propertyElements(""" & propertyElement.propertyId.NumericalValue & """).Description: " & propertyElement.Description & vbCrLf
Next
End Sub
Rem This example shows how to enumerate all properties of an OPC item. For each property, it displays its Id and description.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Option Explicit
Dim ServerDescriptor: Set ServerDescriptor = CreateObject("OpcLabs.EasyOpc.ServerDescriptor")
ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
Dim NodeDescriptor: Set NodeDescriptor = CreateObject("OpcLabs.EasyOpc.DataAccess.DANodeDescriptor")
NodeDescriptor.ItemID = "Simulation.Random"
Dim EasyDAClient: Set EasyDAClient = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
On Error Resume Next
Dim PropertyElements: Set PropertyElements = EasyDAClient.BrowseProperties(ServerDescriptor, NodeDescriptor)
If Err.Number <> 0 Then
WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
WScript.Quit
End If
On Error Goto 0
Dim PropertyElement: For Each PropertyElement In PropertyElements
WScript.Echo "PropertyElements(""" & PropertyElement.PropertyID.NumericalValue & """).Description: " & PropertyElement.Description
Next