Avatar
Please consider registering
guest
sp_LogInOut Log Insp_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 RSSsp_TopicIcon
Create and using Array's
July 7, 2025
13:52, EEST
Avatar
KBrendel
New Member
Members
Forum Posts: 2
Member Since:
July 7, 2025
sp_UserOfflineSmall Offline

Hi there…

Is there anywhere an example how to create and read an array of double, or any other type, available…

Using the help file and search for “Id_ArrayItemType” > No Topics found…

Other variables (byte, double, string, integer) works good with
Result := FNodeManager.CreateVariable(AName);
Result.DataTypeId := AType; // Id_Double for example

But an array? Nothing found in the examples, tutorials or the web.

Using Sentrol 7.8.2 and the TuaServer Component…

Regards, Kai

July 7, 2025
14:56, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1042
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yeah, you are right that this hasn’t been documented.

First, you need to declare the variable data type additionally using ValueRank and ArrayDimensions, although this is just informative so that the clients know what to expect.

MyLevel.ValueRank := 1; // dimensions
MyLevel.ArrayDimensions := [0]; // size of each dimension. 0 means flexible.

ValueRank can also be declared using the standard values, if you need more flexibility:

vrScalarOrOneDimension = -3;
vrAny = -2;
vrScalar = -1; // default for variables
vrOneOrMoreDimensions = 0;

The actual values for the varialbe must be provided with Variant arrays:

var
V: Variant;

V := VarArrayCreate([0,1], varDouble);
V[0] := 0.0;
V[1] := 1.0;
MyLevel.Value := TUaVariant.Create(V);
July 8, 2025
11:05, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1042
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

And this is now included in the Server Tutorial as well.

Thank you for the notice.

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 42
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 100
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 773
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1558
Posts: 6567
Newest Members:
willardmackellar, vnedrenie_koPi, shaylaholton205, PhilesiaGen, rosaurathiel524, Arthurobext, stefanmacneil3, ralni, illuminationscanada, PhillipGit
Moderators: Jouni Aro: 1039, Pyry: 1, Petri: 1, Bjarne Boström: 1054, Jimmy Ni: 26, Matti Siponen: 359, Lusetti: 0
Administrators: admin: 1