Discuss challenges in energy and automation with a global network of peers.

39877members
181208posts

Using ServerObject.Interface to read array-based properties

Ensign

Using ServerObject.Interface to read array-based properties

Hi all,

 

Is it at all possible to read array-based properties using ServerObject.Interface in Scripting?

 

I am trying to read out the VectorValues property of a CProfileFloat profile object and populate a Form with the individual array values.

 

I can't get ServerObject.Interface to work at all as it complains about type mismatches.

 

I was doing something like:

 

Set FlowProfile = Server.FindObject(sFlowProfilePointFullName)

Vector1 = FlowProfile.Interface.VectorValues(0)

 

which did not work.

 

What is the correct way to do this?

3 REPLIES 3
Ensign

Using ServerObject.Interface to read array-based properties

Hi all,

 

Is it at all possible to read array-based properties using ServerObject.Interface in Scripting?

 

I am trying to read out the VectorValues property of a CProfileFloat profile object and populate a Form with the individual array values.

 

I can't get ServerObject.Interface to work at all as it complains about type mismatches.

 

I was doing something like:

 

Set FlowProfile = Server.FindObject(sFlowProfilePointFullName)

Vector1 = FlowProfile.Interface.VectorValues(0)

 

which did not work.

 

What is the correct way to do this?

Highlighted
Lt. Commander
Reply
Loading...

Re: Using ServerObject.Interface to read array-based properties

@rlao works for me...

 

Dim scxServer As ScxV6Server
Set scxServer = New ScxV6Server
scxServer.Connect "Test", "superuser", "superusersuperuser"
Dim objDoubleArray As ScxV6Object
Set objDoubleArray = scxServer.FindObject("New Float")

Dim arrDoubleArray
arrDoubleArray = objDoubleArray.Property("VectorValues")

 

[apologies for bad variable names etc etc... definitely awkward having an array called 'arrDoubleArray' that is full of 'Singles' ;)]


Lead Control Systems Engineer for Alliance Automation (VIC).
All opinions are my own and do not represent the opinions or policies of my employer, or of my cat..
Highlighted
Ensign
Reply
Loading...

Re: Using ServerObject.Interface to read array-based properties

The following JScript example works in a mimic script:

 

var Profile = Server.FindObject( "Time Profiles.Float" );
var Values = Profile.Interface.VectorValues;
var Times = Profile.Interface.VectorTimes;

var FirstValue = Values.getItem(0);
var FirstTime = Times.getItem(0);

 

I've not tried this from VBScript.

 


Andrew Scott, Lead Engineer, AVEVA
Highlighted
Reply
Loading...

Re: Using ServerObject.Interface to read array-based properties

Hi Andrew,

 

I'm trying to do this in VBScript, but your reply actually helped me figure out what I was doing wrong.

 

Basically, in addition to what I was doing in my original post, I was also trying to read VectorValues out into a ReDim variable sized to the MaxVectors of the float profile. Turns out that doesn't work and the solution was actually much, much simpler than what I was trying to do.

 

It was more or less like your JScript answer:

 

Set FlowProfile = Server.FindObject(sFlowProfileFullName)
Dim FlowArray
FlowArray = FlowArray.Interface.VectorValues

Flow1 = FlowArray(0)
Flow2 = FlowArray(1)
Flow3 = FlowArray(2) etc...

 

Extremely simple and I can't believe it took me this long to figure out.