This indeed looks like a bug to me.
When creating an UnorderedSet
from a Vector
object, the order is not maintained.
var c = DOpus.NewVector(
'1. Title',
'2. Artists',
'3. Album',
'4. Album Artist',
'5. Genre',
'6. Year',
'7. Track',
'8. Disk',
'9. Comment',
'10. Publisher',
'11. Copyright',
'12. Rating');
DOpus.Output('===VECTOR===');
for (var i = 0; i < c.length; i++) {
DOpus.Output(c(i));
}
var columns = DOpus.Create().UnorderedSet(c);
DOpus.Output('===SET FROM VECTOR===');
for (var i = 0; i < columns.length; i++) {
DOpus.Output(columns(i));
}
This happens in DO v13.10.2
EDIT: It seems this also happens when adding items one by one. So it looks like the UnorderedSet
is actually giving a random order.
var c = DOpus.Create().Vector(
'1. Title',
'2. Artists',
'3. Album',
'4. Album Artist',
'5. Genre',
'6. Year',
'7. Track',
'8. Disk',
'9. Comment',
'10. Publisher',
'11. Copyright',
'12. Rating');
var columns = DOpus.Create().UnorderedSet();
DOpus.Output('===VECTOR===');
for (var i = 0; i < c.length; i++) {
DOpus.Output(c(i));
columns.insert(c(i));
}
DOpus.Output('===SET FROM VECTOR===');
for (var i = 0; i < columns.length; i++) {
DOpus.Output(columns(i));
}