Professional OPC
Development Tools

logos

ReadMulitpleItems via opda classic (PowerBuilder)

More
07 Nov 2018 11:14 - 07 Nov 2018 11:14 #6833 by support
Thanks for the update!

If, by "could not get it to work before", you mean with the old version (2018.2[corrected]), then the answer is No - it was not working from PowerBuilder with 2018.2, I have tested it as well, and it was the reason why the new methods have been added.

I am glad it works now. I do not know why the first option in the installation did not work. It might be possible to find out more about it by analyzing the log from the Setup program from that time; instructions for finding it are here: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...bleshooting%20the%20Setup.html .


Best regards
Last edit: 07 Nov 2018 11:14 by support.

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

More
06 Nov 2018 20:53 #6832 by scottpaxman
Ok here is some info for you..

1. The first time I installed I clicked on the first line of .net,com and excell development which I thought would work but it did not.
2. I reinstalled with only the com option on line 3 and it seems to work now.

Could this be the issue why I cound not get it to work before? I have not the oroginal methods but I was just curious if you know.

But this looks real promising to me. I just need to do some more testing.

Thanks for your great support!!!

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

More
05 Nov 2018 18:22 #6828 by support
Hello,
I am using trial of the same PowerBuilder version.

What you describe looks like that the PowerBuilder is still using the old version of the QuickOPC type library. Have you exited and re-run PowerBuilder?> When installing the QuickOPC Beta, have you selected that you also want the installation for COM development, on the 2nd page of the installation wizard?

Best regards

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

More
05 Nov 2018 18:08 #6827 by scottpaxman
I tried the examples but my version of Powerbuilder blows up at this line.

readItemArgumentsList.Add(readItemArguments1)

I am using Powerbuilder 2017 R03 is that what you used? I am wondering if powerbulder cannot pass the objects but the simple strings work..

I replied to your email also.

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

More
05 Nov 2018 07:40 #6822 by support
Hello.

I will send you a download link for the Beta of the upcoming version, to the email address you have used to register with these forums. I would be grateful if you can give it a try, because after the release, no more API changes will be possible until the next version (several months) - only bug fixes. In principle, methods have been added to the COM interface to accept and return lists instead of arrays. For example, ReadMultipleItems becomes ReadItemList, ReadMultipleItemValues becomes ReadItemValueList etc. There will be documentation topic covering this.

Here is one of the examples/tests I have used (the whole set is already in the installation of the Beta - look under Examples-COM/PowerScript):

// This example shows how to read the values of 4 different items at once.
 
mle_outputtext.Text = ""
 
// Instantiate the client object
OLEObject client
client = CREATE OLEObject
client.ConnectToNewObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
 
// Prepare arguments.
 
OLEObject readItemArguments1
readItemArguments1 = CREATE OLEObject
readItemArguments1.ConnectToNewObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
readItemArguments1.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
readItemArguments1.ItemDescriptor.ItemID = "Simulation.Random"
 
OLEObject readItemArguments2
readItemArguments2 = CREATE OLEObject
readItemArguments2.ConnectToNewObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
readItemArguments2.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
readItemArguments2.ItemDescriptor.ItemID = "Trends.Ramp (1 min)"
 
OLEObject readItemArguments3
readItemArguments3 = CREATE OLEObject
readItemArguments3.ConnectToNewObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
readItemArguments3.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
readItemArguments3.ItemDescriptor.ItemID = "Trends.Sine (1 min)"
 
OLEObject readItemArguments4
readItemArguments4 = CREATE OLEObject
readItemArguments4.ConnectToNewObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
readItemArguments4.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
readItemArguments4.ItemDescriptor.ItemID = "Simulation.Register_I4"
 
OLEObject readItemArgumentsList
readItemArgumentsList = CREATE OLEObject
readItemArgumentsList.ConnectToNewObject("OpcLabs.BaseLib.Collections.ElasticVector")
readItemArgumentsList.Add(readItemArguments1)
readItemArgumentsList.Add(readItemArguments2)
readItemArgumentsList.Add(readItemArguments3)
readItemArgumentsList.Add(readItemArguments4)
 
// Obtain values.
OLEObject valueResultList
valueResultList = client.ReadItemValueList(readItemArgumentsList)
 
// Display results
Int i
FOR i = 0 TO valueResultList.Count - 1
	OLEObject valueResult
	valueResult = valueResultList.Item[i]
	IF valueResult.Succeeded THEN
		mle_outputtext.Text = mle_outputtext.Text + "valueResult[" + String(i) + "].Value: " + String(valueResult.Value) + "~r~n"
	ELSE
		mle_outputtext.Text = mle_outputtext.Text + "valueResult[" + String(i) + "] *** Failure: " + valueResult.ErrorMessageBrief + "~r~n"
	END IF	
NEXT
Please let me know how it works for you.
Best regards

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

More
01 Nov 2018 14:37 #6811 by scottpaxman
That would be GREAT thank you!!!!!

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

More
01 Nov 2018 09:33 - 01 Nov 2018 14:53 #6809 by support
Hello.

I have investigated this with PowerBuilder. I tried many approaches, and none of them worked. My current conclusion is that PowerBuilder lacks the capability to properly pass COM arrays (SAFEARRAYs) to and from OLE Automation methods.

The solution I have in mind is to use a separate COM object, a kind of collection, instead of the arrays, to hold the method arguments and results. I have made an experiment and it seems to work. Unfortunately, you cannot just do it on your side - it requires that we provide new QuickOPC methods with signatures that accept and return this object, instead of the arrays.

I will try to sneak this improvement (together with some PowerScript examples showing its usage) into the upcoming QuickOPC version (2018.3), which is due in 2 weeks or less from now.

Let me know if that would be fine with you?

Bets regards
Last edit: 01 Nov 2018 14:53 by support.
The following user(s) said Thank You: scottpaxman

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

More
29 Oct 2018 17:53 #6802 by support
Thank you for the additional information. But I still do not know the reason.
I will attempt to get a PowerBuilder trial, and make my own investigation.

I will post here as soon as I have more information to the issue. I may also ask you for some guidance, or simple project showing the problem, in case I get stuck with the PowerBuilder itself.

Best regards
The following user(s) said Thank You: scottpaxman

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

More
29 Oct 2018 17:37 #6801 by scottpaxman
Error number 33
Invalid parameter type calling external object function readmultipleitemvalues at line 116 in ue_polling event of object w_plc_2_db.

This is all the data I can seem to capture..

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

More
29 Oct 2018 17:19 #6800 by scottpaxman
Thank you for your repsonse! I tried the array 0 processing idea but it did not work. let me see if I can gather some better errors codes...

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

Moderators: support
Time to create page: 0.236 seconds

      

 Recommend this on Google