Professional OPC
Development Tools

logos

Powerbuilder

More
16 Feb 2019 17:29 #7096 by admin
Replied by admin on topic Powerbuilder
Hello.

Ad 1. Do not use BrowseAccessPaths. This method is only intended for OPC 1.0 servers who are now rare, and among them, only a handful had implemented it. And, its purpose is different anyway.

The BrowseNodes, BrowseLeaves, BrowseBranches method return "element" object that should contain what you need. You have probably used the "Name" property, which indeed is not qualified. But, there is also an "ItemID", which contains the qualified name.

Ad 2. My PowerBuilder free trial has expired, so at the moment I cannot easily create new PowerBuilder examples. If that becomes necessary, I will try to obtain a new trial. For now, here is an example in VBScript which shows the principle of forcing the synchronous read. Hopefully you will be able to convert it to PowerBuilder. It only requires setting one property inside the EasyDAClient instance (see the line with long comment above it, near the bottom).

Rem This example shows how to read 4 items at once synchronously, and display their values, timestamps and qualities.
 
Option Explicit
 
Dim ReadItemArguments1: Set ReadItemArguments1 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
ReadItemArguments1.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
ReadItemArguments1.ItemDescriptor.ItemID = "Simulation.Random"
 
Dim ReadItemArguments2: Set ReadItemArguments2 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
ReadItemArguments2.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
ReadItemArguments2.ItemDescriptor.ItemID = "Trends.Ramp (1 min)"
 
Dim ReadItemArguments3: Set ReadItemArguments3 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
ReadItemArguments3.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
ReadItemArguments3.ItemDescriptor.ItemID = "Trends.Sine (1 min)"
 
Dim ReadItemArguments4: Set ReadItemArguments4 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
ReadItemArguments4.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
ReadItemArguments4.ItemDescriptor.ItemID = "Simulation.Register_I4"
 
Dim arguments(3)
Set arguments(0) = ReadItemArguments1
Set arguments(1) = ReadItemArguments2
Set arguments(2) = ReadItemArguments3
Set arguments(3) = ReadItemArguments4
 
Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
 
' Specify that only synchronous method is allowed. By default, both synchronous and asynchronous methods are allowed, and 
' the components picks a suitable method automatically. Disallowing asynchronous method leaves only the synchronous method
' available for selection.
Client.InstanceParameters.Mode.AllowAsynchronousMethod = False
 
Dim results: results = Client.ReadMultipleItems(arguments)
 
Dim i: For i = LBound(results) To UBound(results)
    WScript.Echo "results(" & i & ").Vtq.ToString(): " & results(i).Vtq.ToString()
Next


Best regards
The following user(s) said Thank You: spaxman

Please Log in or Create an account to join the conversation.

More
15 Feb 2019 17:17 #7093 by spaxman
Powerbuilder was created by spaxman
I am using the new Powerbuilder examples and they are helpful. However I have 2 quick questions.

1. How can I force a synchronous read on the ReadMultipleItemValues on the easydaclient
2. I have been unsuccessful in PowerBuilder using the BrowseAccessPaths method, below is a code snippet. It dose not fail but I get nothing back. I am connecting to Kepware as my opc server. When I use the other browse methods I only get the tag but I need the fully qualified tag name to pass to ReadMultipleItemValues to make my reads work. So I thought the BrowseAccessPaths would be a better option for me. Any help or suggestions would be greatly appreciated.


sting value[]
--any value[] -- I tried a any value too
try
value = g_opclabs.BrowseAccessPaths(g_serverDescriptor, l_opclabs_node)

CATCH (OLERuntimeError oleRuntimeError3)
mle_outputtext.Text = mle_outputtext.Text + "*** Failure: " + oleRuntimeError3.Description + "~r~n"
RETURN
END TRY

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.168 seconds

      

 Recommend this on Google