Professional OPC
Development Tools

logos

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.

ReadvalueList error

More
19 Jan 2022 17:09 #10558 by info@software2000.it
Thank you very much,
I will try everything as soon as possible to give you feedback.
Best regards

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

More
19 Jan 2022 14:00 #10555 by support
Replied by support on topic ReadvalueList error
Hello,

I have made the workaround. Basically, it is yet another COM object, written in VBScript (and therefore available on every Windows computer), which takes a ValueResult object as an input, and can return its Value property converted to a Double type - which FoxPro is able to consume. It should be noted that with some other OPC operations, what you receive back might be a different object, not ValueResult - and if you need that, the same approach can be used, but there will have to be yet another script to extract the value.

The VBScript component is here:

File Attachment:

File Name: OpcLabs.Ba...sion.zip
File Size:1 KB


You need to extract the .WSC file from the .ZIP file, and place it somewhere where it will then stay. Then, open the command prompt with elevated privileges ("Run as administrator"), navigate to the directory where the .WSC file is located, and register it using the following command:
RegSvr32 OpcLabs.BaseLib.ValueResultExtension.wsc

After this, you can use it to extract the values from the ValueResult object, as in the following example:
* This example shows how to read a UInt32 value, which is otherwise not accessible by FoxPro.
 
THISFORM.OutputEdit.Value = ""
 
* Instantiate the client object.
oClient = CREATEOBJECT("OpcLabs.EasyOpc.UA.EasyUAClient")
 
* Instantiate the extension object for ValueResult, which provides the conversion.
oValueResultExtension = CREATEOBJECT("OpcLabs.BaseLib.OperationModel.ValueResultExtension")
 
* Prepare the input arguments.
 
oReadArguments = CREATEOBJECT("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
oReadArguments.EndpointDescriptor.UrlString = "http://opcua.demo-this.com:51211/UA/SampleServer"
oReadArguments.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10850"
 
oArgumentElasticVector = CREATEOBJECT("OpcLabs.BaseLib.Collections.ElasticVector")
oArgumentElasticVector.Add(oReadArguments)
 
* Read the value and extract the value result object.
 
oResultElasticVector = oClient.ReadValueList(oArgumentElasticVector)
oValueResult = oResultElasticVector.Item[0]
 
* Display the value result in its string form.
THISFORM.OutputEdit.Value = THISFORM.OutputEdit.Value + oValueResult.DisplayString + CHR(13) + CHR(10)
 
IF oValueResult.Succeeded THEN
	* Convert the UInt32 (Int64) value inside the value result to a Double, and display it.
	valueDouble = oValueResultExtension.ValueDouble(oValueResult)
	THISFORM.OutputEdit.Value = THISFORM.OutputEdit.Value + STR(valueDouble) + CHR(13) + CHR(10)
ENDIF
 
*
THISFORM.OutputEdit.Value = THISFORM.OutputEdit.Value + "Finished." + CHR(13) + CHR(10)

I hope this helps
Best regards

P.S.
For easier reference, the contents of the OpcLabs.BaseLib.ValueResultExtension.wsc file is:
<!-- $Header: $ !-->
<!-- Copyright (c) CODE Consulting and Development, s.r.o., Plzen. All rights reserved. !-->
 
<!-- Extends the ValueResult class. !-->
 
<?component error="false"?>
<component>
 
<registration
    progid="OPCLabs.BaseLib.OperationModel.ValueResultExtension"
    classid="{15E5B376-A795-43E9-97A4-271617EE03B4}"
    description="Extends the ValueResult class."
    version="1"
    remotable="true">
</registration>
 
<!-- Declare properties, methods and events of the component !-->
<public>
    <!-- <property name="..."> </property> !-->
    <method name="ValueDouble"> 
        <parameter name="valueResult"/> 
    </method>
</public>
 
<script language="VBScript">
Option Explicit
 
Rem Gets a Double value that is a successful result of the operation.
Function ValueDouble(valueResult)
    Dim result: result = CDbl(valueResult.Value)
    ValueDouble = result
End Function
 
</script>
 
</component>
Attachments:
The following user(s) said Thank You: info@software2000.it

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

More
17 Jan 2022 09:02 #10545 by info@software2000.it
Ok thanks a lot

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

More
17 Jan 2022 08:28 #10541 by support
Replied by support on topic ReadvalueList error
Hello,

I will prepare the suggested workaround #2 (with "helper") object. Please give me some time, I will post here when I have it ready (expect 1-3 days probably).

Best regards

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

More
07 Jan 2022 09:04 #10534 by info@software2000.it
Good morning,
thanks for your kind reply, i think that the second solution, in the meantime we await the quickOPC update, may be the most suitable one;
How can we proceed?
Thank you

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

More
29 Dec 2021 19:44 #10522 by support
Replied by support on topic ReadvalueList error
Hello.

I was able to reproduce the issue with an UInt32 variable inside another server. It really has to do with data types. FoxPro cannot handle this.
In fact, QuickOPC converts UInt32 to a 64-bit integer (Int64), but that makes no difference in the end, because neither of them is supported in FoxPro.

This is going to be difficult to resolve, unless you can change the data type inside the server.

I can think of two workarounds, both of them very ugly:
1. You can use the DisplayString to get a string representation of the returned object. It contains the value in its string form, but inside other pieces of information, so it needs to be parsed out from the string.
2. It should be possible to write some "helper" object e.g. in VBScript/WSC, which would do the value type conversion. I can probably help with that if you think it is better than the above workaround.

Since this is a limitation of the development tool (FoxPro, in this case), and different tools might have different sets of supported data types, it is impossible to satisfy them all at once. So far we have succeeded with our choice of conversions, they work fine in many COM-based tools. FoxPro appears to be severely limited in this respect.

A solution might be to allow the caller to specify the data type, for a client-side conversion inside QuickOPC. For example, UInt32 can safely be represented in a Double (8-byte floating point). That would be possible to implement, but only as new feature, into a new QuickOPC version - which means it will take several months before it is released.

Regards

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

More
28 Dec 2021 16:54 #10515 by info@software2000.it
Ok, in the meantime I wish you happy holidays, but please let me know as soon as you find the catch or the solution, I'm stuck with the customer on my neck.

I also tried in python and the value reads correctly.

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

More
28 Dec 2021 16:34 #10514 by support
Replied by support on topic ReadvalueList error
I will investigate the issue. But it is holiday season. Give me some time please.

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

More
28 Dec 2021 10:57 #10513 by info@software2000.it

info@software2000.it wrote: The only difference that I notice with respect to the values ​​that I can easily read is that in this case the datatype is Uint32, a type that does not exist in foxpro, could this be the problem? perhaps the activex does not manage this type correctly and for this reason the .Value is null?
I can't find any other differences, the code is correct because if I read a different data type, for example a float, it doesn't give me any error and it returns the value.
help please



even using the UAAttributeData object, the .value property gives an error
while the .ServerTimestamp property is written to the screen correctly.
At this point I think it's the object that can't read the UINT32 type in .COM, maybe it's different in .NET.
I don't know what to do anymore, I've tried them all

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

More
28 Dec 2021 10:04 #10512 by info@software2000.it
The only difference that I notice with respect to the values ​​that I can easily read is that in this case the datatype is Uint32, a type that does not exist in foxpro, could this be the problem? perhaps the activex does not manage this type correctly and for this reason the .Value is null?
I can't find any other differences, the code is correct because if I read a different data type, for example a float, it doesn't give me any error and it returns the value.
help please

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

Moderators: support
Time to create page: 0.068 seconds