10:10, EET
August 13, 2013
I 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
You 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
Lets 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
Yes, 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.
Most Users Ever Online: 1919
Currently Online:
6 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 734
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1524
Posts: 6453
Newest Members:
rickie5305, shaylamaggard4, rickyjuarez140, jonathonmcintyre, fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmpModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1027, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1