I was trying to declare an array of strings like so:
str ar1[2] = ['One','Two'];
Getting a syntax error. How can I initialize and assign an array like above?
I was trying to declare an array of strings like so:
str ar1[2] = ['One','Two'];
Getting a syntax error. How can I initialize and assign an array like above?
['One', 'Two']
is a container in the axapta. axapta has no syntax for initialize an array. use:
str ar1[2];
ar1[1] = 'One';
ar1[2] = 'Two';
In AX, you'r trying to assign a container collection to an array collection. Which is incorrect, Therefore you can try to follow one of the approach listed below:
Using an array:
str number[2];
// Array starts at one in AX; hence number[0] will clear every value in the array
number[1] = 'One';
number[2] = 'Two';
The other way, would be to use a container:
container con;
con += 'One'; // Equivalent to 'con = conIns(con, conLen(con)+1, 'One');
con += 'Two'; // Equivalent to 'con = conIns(con, conLen(con)+1, 'Two');
or a shortcut would be to use:
container con = ['One', 'Two'];