cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kmisniak
Level 3

InstallScript and arrays of custom data structures

Jump to solution

Hi, I am declaring array of custom data structure (typedef syntax). But each element is null, so I am not able to assign property value this way: myArray(0).myProp = "".

When I assign myArray(0) = someVariableOfMyDataStructure as a first step, everything is ok.

How to initiate the array of custom data structure?

Regards

Konrad

 

Labels (1)
0 Kudos
(1) Solution
banna_k
Revenera
Revenera

Hi @kmisniak ,

 

See the below example to initialize array of custom structures.

///////////////////////////////// structure

typedef STRUCT
begin
NUMBER nval;
NUMBER nval1;
NUMBER nval2;
end;

prototype object newStruct();

/// function to return the structure object

function object newStruct()
STRUCT strct;
begin
return strct;
end;

////// function where it initialize the array

function  InitializeArray()

int i;
STRUCT nArray(10);
begin

for i = 0 to 9
nArray(i) = newStruct();
endfor;

 

nArray(1).nval =1;
nArray(1).nval1 =1;

 

end;

View solution in original post

0 Kudos

(1) Reply
banna_k
Revenera
Revenera

Hi @kmisniak ,

 

See the below example to initialize array of custom structures.

///////////////////////////////// structure

typedef STRUCT
begin
NUMBER nval;
NUMBER nval1;
NUMBER nval2;
end;

prototype object newStruct();

/// function to return the structure object

function object newStruct()
STRUCT strct;
begin
return strct;
end;

////// function where it initialize the array

function  InitializeArray()

int i;
STRUCT nArray(10);
begin

for i = 0 to 9
nArray(i) = newStruct();
endfor;

 

nArray(1).nval =1;
nArray(1).nval1 =1;

 

end;

0 Kudos