Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Writing a single value of an array
April 13, 2014
21:57, EEST
Avatar
maxdo
Member
Members
Forum Posts: 4
Member Since:
April 13, 2014
sp_UserOfflineSmall Offline

Hi,
How can I write a single value of an array containing float values with writeValue() or writeAttribute()?
Thanks

April 14, 2014
7:16, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Unfortunately, that’s not currently possible, but you need to use write like this

NumericRange indexRange = new NumericRange(1); // Your array index(es) here
final WriteValue[] writeValues = { new WriteValue(nodeId, Attributes.Value,
indexRange.toString(), new DataValue(new Variant(value))) };
final WriteResponse response = client.write(writeValues);
final StatusCode result = response.getResults()[0];

We will need to introduce a new overload for writeValue() to enable specifying the range as well.

April 15, 2014
21:56, EEST
Avatar
maxdo
Member
Members
Forum Posts: 4
Member Since:
April 13, 2014
sp_UserOfflineSmall Offline

Sorry, but I always get StatusCode: Bad_IndexRangeInvalid (0x80360000) “The syntax of the index range parameter is invalid.”
I tested it with SampleConsoleServer / Client, trying to write a value of the “Int16Array” in “StaticArrayVariables”.
Thanks

April 16, 2014
14:11, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

How do you specify the range? We have been updating the NumericRange class recently, so you can also contact our support to test with the latest version (I also added new overload methods as mentioned to the SDK 2.0 beta already).

April 18, 2014
9:31, EEST
Avatar
maxdo
Member
Members
Forum Posts: 4
Member Since:
April 13, 2014
sp_UserOfflineSmall Offline

I tested it with your code snippet. Also tried it with different directly set String parameters in WriteValue(): “1:-1” (which equals NumericRange(1) ) , “1:1”, etc.
What is the correct syntax? SDK version is 1.9.1.

April 18, 2014
14:18, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

The correct string format is “1”

April 23, 2014
11:12, EEST
Avatar
maxdo
Member
Members
Forum Posts: 4
Member Since:
April 13, 2014
sp_UserOfflineSmall Offline

This way it works. “value” has to be formatted as array element…
Thanks!

June 26, 2014
16:02, EEST
Avatar
gjevremovic
Member
Members
Forum Posts: 49
Member Since:
January 30, 2014
sp_UserOfflineSmall Offline

Hi,
is it possible in this way to write single element of for example 2-dimesional array of simple type. I can’t figure out how to do that with NumericRange.
Or it is simplier to get the array, change the desired element of it and write the array back?
BR,
Goran

June 27, 2014
7:25, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, it is possible, if the server also supports that. You will need the new SDK 1.5 (or 2.0 beta) for that, though. NumericRange was extended to support multiple dimensions just recently.

June 27, 2014
13:23, EEST
Avatar
gjevremovic
Member
Members
Forum Posts: 49
Member Since:
January 30, 2014
sp_UserOfflineSmall Offline

Hi Aro,
do you mean if server supports legacy mode for arrays?
Thnks

June 27, 2014
13:37, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

I mean if the server supports multidimensional arrays and NumericRange. It should, of course, but we just added support for the Java stack, and I am not sure about all other servers.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
17 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: 731

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

inilarythikibia, rickykennion, PromotionToold, HypromeImpupe, toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1