Topic RSS10:10, EET
August 13, 2013
OfflineI have a Event with an Attribute which is a complex type, so in the modeler it looks like this:
–BaseEventType
—-MyEvent
——–MyVariable
———-MySubVariable1
———-MySubVariable2
MyVariable has the value Rank of Array and stores several Objects with MySubVariable1 and MySubVariable2.
How do i have to subscribe the Array MyVariable and how do I read it out?
From my understanding the filter select clause should look like this:
filter.setSelectClause(new SimpleAttributeOperand[] {new SimpleAttributeOperand(NodeIdOfMyVariable, BrowsePathOfMyVariable, Attributes.Value, null)});
The reading out could look like this, but I do not know what I get from getValue() and how i read out all the values of the MyVariable in the array.
onEvent(MonitoredEventItem monitoredItem, Variant[] values) {
Object var = values[0].getValue();
}
13:20, EET
December 21, 2011
OfflineYou will get the value that your server provides for MyVariable
There is nothing automatic that will make up the MyVariable value from the sub-variables, so you need to create the array value yourself in the server.
You can read information about the value from the Variant (such as isArray and compositeClass).
If you wish to get the array components separately, you can of course create a separate field for each in the filter.
14:08, EET
August 13, 2013
OfflineLets see if I understood this.
So the solution would be to create a class MyVariable:
class MyVariable {
String MySubVariable1;
String MySubVariable2;
}
Then I have to make a jar and use the same Class in Client and Server.
i can then cast the Variant-Value to MyVariable:
onEvent(MonitoredEventItem monitoredItem, Variant[] values) {
MyVariable[] vars = (MyVariable[]) values[0].getValue();
}
14:41, EET
December 21, 2011
OfflineYes, except that it’s not quite that simple in practice… You need to define it as a Structure and ensure that the type is also encoded properly through the stack. You should take a look at the blog post Using Complex DataTypes, which explains it in detail.
1 Guest(s)

Log In
Register