Forum Discussion
felix_ossigbona
12 years agoNew Contributor
Ok, I have found out one way to create an array of objects. You first need to create a Group:
// First create Array to put the Objects in
data = ODT.Data.AddGroup("TestData");
arr = data.AddVarOfArrayType("TestArray");
You can then use the AddItemOfClassType method to append objects:
// Populate array with Objects
obj = arr.AddItemOfClassType("TestClass");
obj.username = "felix";
obj.password = "mypassword";
// Populate array with Objects
obj = arr.AddItemOfClassType("TestClass");
obj.username = "frank";
obj.password = "mypass";
The only way I have found to iterate throught the objects is to use the .Run() method which means I don't really have control over the loop.
Hopefully there is another way...
// First create Array to put the Objects in
data = ODT.Data.AddGroup("TestData");
arr = data.AddVarOfArrayType("TestArray");
You can then use the AddItemOfClassType method to append objects:
// Populate array with Objects
obj = arr.AddItemOfClassType("TestClass");
obj.username = "felix";
obj.password = "mypassword";
// Populate array with Objects
obj = arr.AddItemOfClassType("TestClass");
obj.username = "frank";
obj.password = "mypass";
The only way I have found to iterate throught the objects is to use the .Run() method which means I don't really have control over the loop.
Hopefully there is another way...