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.

ReadMultipleItemValues Function Error

More
07 Dec 2020 19:18 #9233 by support
You are passing an array of DAItemValueArguments to ReadMultipleItemValues, which expect an array of DAReadItemArguments.

Since DAItemValueArguments is a structure that is used when writing the values (and not reading them), the code makes no sense. If it had compiled before, which could have been due to some implicit conversion, it was not correct.

Use DAReadItemArguments instead.

Regards
The following user(s) said Thank You: PythonByte

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

More
07 Dec 2020 14:56 #9230 by PythonByte
Guys,
I have a working function in version 5.23 and I upgraded to the latest version 5.59 and it doesn't work anymore. It seems the parameter type have changed or something for the ReadMultipleItemValues function. Here is my working solution in 5.23:
Public Function SyncReadItems(ByRef Tags As SQTags) As Boolean
 
        Dim argumentArray As DAItemValueArguments() = New DAItemValueArguments(Tags.Count - 1) {}
        Dim handleResult() As ValueResult
 
 
        For i As Integer = 0 To Tags.Count - 1
 
            argumentArray(i) = New DAItemValueArguments(m_MachineName, m_OPCServerName, Tags.Item(i).ClientTagname, Tags.Item(i).Value)
 
        Next i
 
        handleResult = m_opcClient.ReadMultipleItemValues(argumentArray)
 
        For i As Integer = 0 To Tags.Count - 1
 
            If Not handleResult(i).Succeeded Then
                Return False
            End If
 
        Next i
 
        Return True
 
    End Function

m_opcClient.ReadMultipleItemValues(argumentArray) line is complaining about the argumentArray. It says:

'DAItemValueArguments()' cannot be converted to 'DAReadItemArguments()' because 'DAItemValueArguments' is not derived from 'DAReadItemArguments'

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

Moderators: support
Time to create page: 0.043 seconds