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.

Access returned array elements from C++

More
26 Oct 2016 16:34 #4518 by support
I suppose this is with the sample XML DA server that we provide on the Web. That is a sample code from OPC Foundation, and I do not know what it is precisely supposed to do.

Do you have any reason to think that there is something wrong with it?

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

More
26 Oct 2016 16:16 #4517 by Vasanth
Thanks for the input.

I have one more query, Index values are always same.Dynamic/Analog Types/Int[] for this tag 3 indexes are there and values are 62464 only, for first iteration and the further iteration it get changes.

Please can you clarify on this, attached image for ref.
Attachments:

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

More
26 Oct 2016 11:12 #4516 by support
I am not aware of any generic way of doing this.
The following user(s) said Thank You: Vasanth

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

More
26 Oct 2016 09:55 #4515 by Vasanth
I mean cross check the values that are coming from server is correct or wrong.

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

More
26 Oct 2016 07:40 #4503 by support
I do not understand what you mean by "verifying" array tag values. Please clarify.

We do not modify the incoming values, therefore the negative values should be the values that the server has sent.

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

More
26 Oct 2016 07:30 #4502 by Vasanth
Hi,

How do I verify array tag values for QuickOPC XML demo server for tags,
Dynamic/Analog Types/Int[]
Dynamic/Analog Types/Double[]

Alternatively negative values are coming for both the tags and its my coding issue or these are actual values from server? Please refer attached image.

Thanks.
Attachments:

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

More
24 Oct 2016 07:30 #4498 by support
Item IDs are completely opaque to our client part. Whatever you specify, we pass to the server. If the server accepts it - fine. If it does not, it returns an error, and we pass that error to you.

Without going into server specific, we have therefore no way of determining whether, for example, "LXX/Wec/XXXXX31/Status/St[1]" is a good or wrong of way of specifying an item ID. It depends on the server an don its configuration. The server also may or may not have a way to specify Item IDs that correspond to array elements. It's your task to figure that out.

If you only want to access an element of an array and the server does not allow doing that using an Item ID, then, in the client code, you need to read/write/subscribe the whole array, and add a code that would handle just the element(s) you need.
The following user(s) said Thank You: Vasanth

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

More
24 Oct 2016 06:27 #4497 by Vasanth
Hi,

I have question on array tags if this is my array tag LXX/Wec/XXXXX31/Status/St-1, can I pass it like below to get values for this,

ex: LXX/Wec/XXXXX31/Status/St[1], this way its throwing E_UNKNOWN_ITEMNAME failure.

Therefore, I need to execute array tag like this LXX/Wec/XXXXX31/Status/St[] and get the safe-array from their I need to take index value[1], is it like that?

Please confirm if my understanding is wrong.

Thanks,
Vasanth

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

More
29 Sep 2016 16:39 - 29 Sep 2016 16:40 #4404 by support
I have found the problem. You have a bug there, a one that is somewhat difficult to spot. Here:
SAFEARRAY* saValues = DAVtqPtr->Value.parray;
In this statement, DAVtqPtr->Value returns a _variant_t that is destroyed right after the assignment is complete. So you take the .parray from something, and then you destroy it. The resulting saValues pointer is therefore invalid.

Rewrite it like this:
 _variant_t value = DAVtqPtr->Value;
 SAFEARRAY* saValues = value.parray;

This keeps the '_variant_t value' around until the end of the statement block.

Regards

Best regards
Last edit: 29 Sep 2016 16:40 by support.
The following user(s) said Thank You: Vasanth

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

More
29 Sep 2016 15:17 #4403 by Vasanth
Hi,

Yes, I use public demo server only (opcxml.demo-this.com/XmlDaSampleServer/Service.asmx)

Yes, I do have array tags in my project. That's why before I write production code wanted to make every thing works fine.

Thanks.

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

Moderators: support
Time to create page: 0.077 seconds