X++ collection classes don’t have indexers, so you have to use method calls. Also don’t expect that collections with same names behave in the same way in different languages.
This is a close approximation of your code in X++:
“Can the arrayList be separated?” -What do you mean. Each variable can held only one value at given time - either you need more variables, or different timing (so you don’t overwrite the reference in wrong moment). Please show us your code if you want a concrete answer.
Maybe you should explain what you try to achieve - I suspect you try use the Python way without knowing the X++ way.
Map TestMap = new Map(Types::String, types:Class);
Array TestArray = new Array(Types::String);
While Select * From MSetup // Example: This MSetup only contain 2 value, which is 1. Size, 2. Type
{
While Select * From MSpecification where MSpecification.SetupName == MSetup.SetupName // Example: This MSpecification contain value For SetupName(Size) = Size1, Size2, Size3 and For SetupName(Type) = Type1, Type2, Type3
{
TestArray.value(i, MSpecification.SpecName);
}
TestMap.insert(MSetup.SetupName, TestArray);
}
// Expected Results for
TestArray = map.lookup(‘Size’);
For (i=1, i<10, i++)
{
info(TestArray.value(i)); // Expected results should be = Size1, Size2, Size3.
}
// Expected Results for
TestArray = map.lookup(‘Type’);
For (i=1, i<10, i++)
{
info(TestArray.value(i)); // Expected results should be = Type1, Type2, Type3.
}
}
Thanks Martin for the help, i wanna know how to implement this kind of example in X++.