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.

How to use WriteMultipleItems method

More
28 Sep 2010 09:22 #85 by support
Have you inspected the contents of opResults() ? The WriteMultipleItemValues method does not throw exceptions except for coding errors such as invalid arguments - all errors are inside this array, as there may be a mix of good and bad ones, and throwing a single error for the whole operation would not give proper indication of the outcome.

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

More
26 Sep 2010 15:28 #84 by ianfenton@rmtrobotics.com
Here's the code. As I said previously there are no errors but data didn't show up on PLC either.Dim m_asTagsToWrite(5) As DAItemValueArgumentsm_asTagsToWrite(0) = New DAItemValueArguments("", se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_MESSAGE, MsgID)m_asTagsToWrite(1) = New DAItemValueArguments("", se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_PARAM_ADAM, tmpMsg.Params.ADAMID)m_asTagsToWrite(2) = New DAItemValueArguments("", se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_PARAM_DEST, tmpMsg.Params.DestinationID)m_asTagsToWrite(3) = New DAItemValueArguments("", se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_PARAM_NEST, tmpMsg.Params.NestID)m_asTagsToWrite(4) = New DAItemValueArguments("", se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_PARAM_PART, tmpMsg.Params.PartID)m_asTagsToWrite(5) = New DAItemValueArguments("", se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_MSG_READY, "True")Dim opResults() As OperationResult = m_OPC.WriteMultipleItemValues(m_asTagsToWrite)So now I am sending each tag separately using m_OPC.WriteItemValue which does work but I'd prefer to do the multiple writes.

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

More
23 Sep 2010 13:17 #82 by support
The method that complements WriteItemValue but works with multiple items is named WriteMultipleItemValues, not WriteMultipleItems. Maybe that's why it does not work. If you are using the proper one, WriteMultipleItemValues, and it still does not work, can you please post your code here for review.

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

More
23 Sep 2010 13:13 #81 by support
From: i.
Sent: Thu 9/23/2010 2:54 PM
To: Zbynek Zahradnik
Subject: RE: WriteMultipleItems



Zbynek,

Thank you fo rthe response. [...]

As a follow up to my post, I tried downloading the newest install for
QuickOPC.NET and the WriteMultipleItems did not generate an error but
it also did not work. Instead I made 6 individual WriteItemValues
calls instead which did work. So for now I am leaving it this way but
I would prefer to use the WriteMultipleItems call.

Thanks.


I.

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

More
23 Sep 2010 08:24 #77 by support
I think you may actually want to use WriteMultipleItemValues method. Writing VTQ (Value/Timestamp/Quality) is a feature introduced in OPC-DA 3.0, and not many servers support it (this is fine - it only has its merits for certain cases anyway). So, the error you are getting may be a correct reaction from the OPC server, to a request that it cannot fulfill. I base this conclusion also on the fact that you do not seem to pass anything really "useful" as Timestamp or Quality.
An example for WriteMultipleItemValues can be found in this thread: www.opclabs.com/Support/Online....
Note that there used to be a bug in this method, so make sure you grab the recent download from this site, or at least verify that you have at least 5.00.1321.1.

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

More
23 Sep 2010 08:01 #76 by support
From: ...
Sent: Thu 9/23/2010 2:41 AM
To: Zbynek Zahradnik
Subject: WriteMultipleItems


[...] . I am trying to use the WriteMultipleItems method but I keep getting an error, something like "OPC server doesn't support timestamp and/or state"...or somthing like that. I can't figure out how to populate the array for the write. Can you tell me what I am doing wrong? Here is the code snippet after trying several variations;

Dim m_asTagsToWrite(5) As DAItemVtqArguments
Dim MsgID As String = fnConvertMessagetoID(tmpMsg.Command)

m_asTagsToWrite(0) = New DAItemVtqArguments(se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_MESSAGE, New DAVtq(MsgID), New Object()) ', Nothing, Nothing) ', Now, New DAQuality())

m_asTagsToWrite(1) = New DAItemVtqArguments(se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_PARAM_ADAM, New DAVtq(tmpMsg.Params.ADAMID), New Object()) ', Now, New DAQuality())

m_asTagsToWrite(2) = New DAItemVtqArguments(se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_PARAM_DEST, New DAVtq(tmpMsg.Params.DestinationID), New Object()) ', Now, New DAQuality())

m_asTagsToWrite(3) = New DAItemVtqArguments(se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_PARAM_NEST, New DAVtq(tmpMsg.Params.NestID), New Object()) ', Now, New DAQuality())

m_asTagsToWrite(4) = New DAItemVtqArguments(se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_PARAM_PART, New DAVtq(tmpMsg.Params.PartID), New Object()) ', Now, New DAQuality())

m_asTagsToWrite(5) = New DAItemVtqArguments(se.ServerClass, "Channel1.ADAM_GE.API." & TAG_IN_MSG_READY, New DAVtq("True"), New Object()) ', Now, New DAQuality())

Dim opResults() As OperationResult = m_OPC.WriteMultipleItems(m_asTagsToWrite)

I hope you can understand this code enough to figure this out because I've tried everything I can and can't figure it out.

Thank you. Submitted By: I.

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

Moderators: support
Time to create page: 0.052 seconds