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.

Unable to read/write an array using UAIndexRangeList.OneDimension

More
05 Dec 2023 15:31 #12451 by support
Thank you.
Unless you have an information pointing to the contrary, my conclusion is that the server does not support reading index ranges (which is a non-compliant behavior I think).

Regards

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

More
05 Dec 2023 15:23 #12450 by Scaglioni

Hello.
thank you.

However, you have not answered my question 1), which reads "Do you have any other OPC UA client ....". You answered "....I tried on another server ....", which is not what I asked about. I wanted to know if you have tried another client with the SAME server. Can you answer that?

Ah ok. I tried only to access the array with UA Expert client but it reads the entire array. I don't have found a way to access a single element.

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

More
05 Dec 2023 15:14 #12449 by support
Hello.
thank you.

However, you have not answered my question 1), which reads "Do you have any other OPC UA client ....". You answered "....I tried on another server ....", which is not what I asked about. I wanted to know if you have tried another client with the SAME server. Can you answer that?

Regarding question 2), note that parsing "1,2" gives two-dimensional range of indices and is therefore incorrect for your purpose; however, "1:2" represents a one-dimensional range and should work.

Regards

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

More
05 Dec 2023 15:06 #12448 by Scaglioni

Hello.

Your code appears correct. It might be a server problem.

Questions:

1) Do you have any other OPC UA client that is capable of reading array ranges, and if so, have you tried doing the same with it, and what were the results?
2) What happens if you attempt to extract more than one element? E.g. UAIndexRangeList.OneDimension(1, 3)

Best regards

1) Yes, I tried on another server and I had the element I requested.

2) I tried to extract more elements with this code:

var err = UAIndexRangeList.TryParse("1,2", out list);
if (err != null)
MessageBox.Show(err.ToString());

var value = easyUAClient1.ReadValue(
new UAReadArguments(
this._descriptor,
nodeIdTextBox.Text, list)
);

Error received:

Status is not good: {BadIndexRangeInvalid}. The syntax of the index range parameter is invalid.
+ The index range list used was "[1, 2]".
+ The node descriptor used was: NodeId="ns=1;s=R1:D0[0..499]".
+ The client method called (or event/callback invoked) was 'ReadMultiple[1]'.

I tried with "1:2" and I reveived the same error:

Status is not good: {BadIndexRangeInvalid}. The syntax of the index range parameter is invalid.
+ The index range list used was "[1:2]".
+ The node descriptor used was: NodeId="ns=1;s=R1:D0[0..499]".
+ The client method called (or event/callback invoked) was 'ReadMultiple[1]'.

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

More
03 Dec 2023 11:01 #12427 by support
Hello.

Your code appears correct. It might be a server problem.

Questions:

1) Do you have any other OPC UA client that is capable of reading array ranges, and if so, have you tried doing the same with it, and what were the results?
2) What happens if you attempt to extract more than one element? E.g. UAIndexRangeList.OneDimension(1, 3)

Best regards

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

More
01 Dec 2023 16:29 #12422 by Scaglioni
Hello, I am unable to read/write array elements using indexing with GEFRA machines.
Here is the code I used to test the issue:

var value = easyUAClient1.ReadValue(
new UAReadArguments(
this._descriptor,
nodeIdTextBox.Text, UAIndexRangeList.OneDimension(1))
);

The error I received is:
'Opc.UA.ServiceResult=0x80360000/OPC UA service result - {BadIndexRangeInvalid}. The syntax of the index range parameter is invalid. [...]'

If I try to read/write the entire array, it works.
Example of code for reading the entire array:

var err = UAIndexRangeList.TryParse(string.Empty, out list);
if (err != null)
MessageBox.Show(err.ToString());
var value = easyUAClient1.ReadValue(
new UAReadArguments(
this._descriptor,
nodeIdTextBox.Text, list)
);

Is there something wrong with my code?.

This is the node I tried to read:



Thank you
Attachments:

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

Moderators: support
Time to create page: 0.058 seconds