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
convert input string 1, 2, 3, 4, 5 to variant array datatype?
June 11, 2018
18:28, EEST
Avatar
Christv
Member
Members
Forum Posts: 9
Member Since:
August 9, 2016
sp_UserOfflineSmall Offline

in sample console I see
Object convertedValue = dataType != null ? client.getAddressSpace()
.getDataTypeConverter().parseVariant(value, dataType)
: value;

but this does not work for array data types.

so my question is how to convert the string “1, 2, 3, 4, 5” to the correct datatype variant if nodeid is a array via DataTypeConverter.

June 12, 2018
11:16, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

In practice you cannot do this automatically. You can parse the string via normal java code and convert the individual elements maybe. However in practice as soon as the input data is more complex it is best to do the conversion as well and just pass the value to Variant constructor.

The DataTypeConverter main use is with the SDK for the event ContentFilter “Cast” operatator for converting simple types to another as defined in the specification Part 4 section 7.4.3. “FilterOperator”. It mentions that “Arrays of a source type can be converted to arrays of the target type by converting each element.”, so there are no rules on parsing a Scalar String to an array, it is out of scope.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

ibrahim: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 680

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6259

Newest Members:

sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com, aytule

Moderators: Jouni Aro: 1009, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1