- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- InstallScript and arrays of custom data structures
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
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
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;
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;