Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
OLE error code 0
You understand that now you need to test .Succeeded or .Exception of the returned result element(s), and also the status in the attribute data, before accessing the actual value, right?
It would be great if, after you finalize your work, you let me know here whether the original issue (pop-up boxes with OLE error code 0) has been resolved.
Best regards
Please Log in or Create an account to join the conversation.
- info@software2000.it
- Topic Author
- Offline
- Platinum Member
- Posts: 33
- Thank you received: 2
Please Log in or Create an account to join the conversation.
To work around it, try using ReadValueList instead of ReadMultipleValues. The example (in PowerScript) of that is below:
// This example shows how to read the Value attributes of 3 different nodes at once. Using the same method, it is also possible
// to read multiple attributes of the same node.
mle_outputtext.Text = ""
// Instantiate the client object
OLEObject client
client = CREATE OLEObject
client.ConnectToNewObject("OpcLabs.EasyOpc.UA.EasyUAClient")
// Prepare arguments. By default, the Value attributes of the nodes will be read.
OLEObject readArguments1
readArguments1 = CREATE OLEObject
readArguments1.ConnectToNewObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
readArguments1.EndpointDescriptor.UrlString = "http://opcua.demo-this.com:51211/UA/SampleServer"
readArguments1.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/;i=10845"
OLEObject readArguments2
readArguments2 = CREATE OLEObject
readArguments2.ConnectToNewObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
readArguments2.EndpointDescriptor.UrlString = "http://opcua.demo-this.com:51211/UA/SampleServer"
readArguments2.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/;i=10853"
OLEObject readArguments3
readArguments3 = CREATE OLEObject
readArguments3.ConnectToNewObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
readArguments3.EndpointDescriptor.UrlString = "http://opcua.demo-this.com:51211/UA/SampleServer"
readArguments3.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/;i=10855"
OLEObject readArgumentsList
readArgumentsList = CREATE OLEObject
readArgumentsList.ConnectToNewObject("OpcLabs.BaseLib.Collections.ElasticVector")
readArgumentsList.Add(readArguments1)
readArgumentsList.Add(readArguments2)
readArgumentsList.Add(readArguments3)
// Obtain values.
OLEObject valueResultList
valueResultList = client.ReadValueList(readArgumentsList)
// Display results
Int i
FOR i = 0 TO valueResultList.Count - 1
OLEObject valueResult
valueResult = valueResultList.Item[i]
IF valueResult.Succeeded THEN
mle_outputtext.Text = mle_outputtext.Text + "Value: " + String(valueResult.Value) + "~r~n"
ELSE
mle_outputtext.Text = mle_outputtext.Text + "*** Failure: " + valueResult.ErrorMessageBrief + "~r~n"
END IF
NEXT
// Example output:
//
//Value: 8
//Value: -8.06803E+21
//Value: Strawberry Pig Banana Snake Mango Purple Grape Monkey Purple? Blueberry Lemon^
Basically, you create the same UAReadArguments as you already have, but then, instead of placing them into a VFP array, you create an "OpcLabs.BaseLib.Collections.ElasticVector", and use its Add method to add the arguments to it. And then pass the elastic vector to the ReadValueList method. The result is a list that can, however, be indexed as an array (if you get pass the ReadValueList method and get issues extracting the result elements, let me know here, too).
Best regards
Please Log in or Create an account to join the conversation.
- info@software2000.it
- Topic Author
- Offline
- Platinum Member
- Posts: 33
- Thank you received: 2
this is the code snippet and attached screenshot of the error.
PROC LEGGIMULTI
param lpara
Dimension arguments[2]
Dimension results[10]
ReadArguments1=CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
ReadArguments2=CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
ReadArguments1.EndpointDescriptor.UrlString = alltrim(.w_URI)
ReadArguments1.NodeDescriptor.NodeId.ExpandedText ="nsu=urn:eclipse:milo:hello-world;ns=2;s="+alltrim(.w_NODOM)+"/param_lifetimecycles"
ReadArguments2.EndpointDescriptor.UrlString = alltrim(.w_URI)
ReadArguments2.NodeDescriptor.NodeId.ExpandedText ="nsu=urn:eclipse:milo:hello-world;ns=2;s="+alltrim(.w_NODOM)+"/state_production"
arguments[1]=ReadArguments1
arguments[2]=ReadArguments2
results=oClient.ReadMultipleValues(arguments)
ENDPROC
I don't know what to do anymore, help ...
THANKS
Please Log in or Create an account to join the conversation.
You will need to take an example in some other COM-based language, such as VBScript or Delphi (Object Pascal), and rewrite them in FoxPro. These examples are here:
opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...0multiple%20item%20values.html
Best regards
Please Log in or Create an account to join the conversation.
- info@software2000.it
- Topic Author
- Offline
- Platinum Member
- Posts: 33
- Thank you received: 2
below is a small piece of code where I invoke the ReadValue several times to test if there are alarms.
FOR nstati = 1 to .w_MAXSTATI
VALUE = '. W_S' + alltrim (str (nstati))
MNEMONIC = '. W_MS' + alltrim (str (nstati))
STATUS = 'w_E' + alltrim (str (nstati))
IMAGE = '. W_SI' + alltrim (str (nstati))
REFOBJIMG = '. W_bs' + alltrim (str (nstati)) + '. Picture'
IF & VALUE> 0
if vartype (oClient.ReadValue (alltrim (.w_URI), "nsu = urn: eclipse: milo: hello-world; ns = 2; s =" + alltrim (.w_NODOM) + "/" + alltrim (& MNEMONIC))) = 'L'
if oClient.ReadValue (alltrim (.w_URI), "nsu = urn: eclipse: milo: hello-world; ns = 2; s =" + alltrim (.w_NODOM) + "/" + alltrim (& MNEMONIC))
& STATUS = 2
else
& STATUS = 1
endif
& IMAGE = iif (& STATE = 1, "bmp \ allarmerosso.bmp", iif (& STATE = 2, "bmp \ allarmeverde.bmp", "bmp \ trasp.bmp"))
& REFOBJIMG = & IMAGE
endif
ENDIF
ENDFOR
Can you please piostarmi a VisualFoxpro snippet to use the ReadMultipleValue method instead of ReadValue and maybe how to use events to receive an event if an alarm occurs?
I would be very grateful I can't find anything on the net
Please Log in or Create an account to join the conversation.
the code you posted does not show the error handling, which is what I wanted to look at.
There is no way to "pre-check", and there should be no reason for it, because when mechanisms for handling errors work well, one can simply check the result of the operation, without having to pre-check something.
If, for some reason, the error from ReadValue method cannot be "caught", I suggest to use some of the methods that do not throw errors for operation failures; instead, they return objects that you can further inspect to test whether the operation succeeded or failed. That is, you can use ReadMultipleValues or ReadValueList instead. If you read just one node, you will construct an argument array or list with one element, and an array with one result element will be returned to you.. The code will be longer, but the advantage is that these method never "throw" an error. Instead, your code will look at the Exception property of the result element, and if it is null, there was a success. If it is not null, there was a failure, and the Exception property contains an exception object with the details.
Best regards
Please Log in or Create an account to join the conversation.
- info@software2000.it
- Topic Author
- Offline
- Platinum Member
- Posts: 33
- Thank you received: 2
oClient = CREATEOBJECT("OpcLabs.EasyOpc.UA.EasyUAClient")
........
oClient.ReadValue(alltrim(.w_URI), "nsu=urn:eclipse:milo:hello-world;ns=2;s="+alltrim(.w_NODOM)+"/"+alltrim(&MNEMONIC))
when the machine is turned on no problem, when it is turned off everything goes haywire, the softweare no longer responds, is there no way to check if the machine is turned on by some command before reading or writing?
thanks
Please Log in or Create an account to join the conversation.
this might be some error in OEL Automation "plumbing" inside Visual FoxPro. We do not raise "OLE error code 0" form our code.
Which QuickOPC method is causing this precisely? Such as Read, ReadMultiple, ReadValue, ReadMultipleVaklues, etc.?
Can you post here the snippets of your code that show how you call the method, and how you do the error handling?
Thank you
Please Log in or Create an account to join the conversation.
- info@software2000.it
- Topic Author
- Offline
- Platinum Member
- Posts: 33
- Thank you received: 2
We have a problem urgently enough to solve, I have already checked on the forum but I have not found anything that can help me.
We use the COM part of your application through VisualFoxPro and, if the ocpua server and the related connected machinery are turned on, everything works correctly; on the contrary, if the server is off, obviously an OLE error is returned which I can avoid by testing before communicating if the server's IP address responds.
If, however, the machine are spent after the default easyOPC timeout I receive an OLE error as per attachment and despite having instanced the ON ERROR function of visulafoxpro the OCX error is constantly presented to me.
What can we do?
Thank you
Please Log in or Create an account to join the conversation.