The documentation for %Collection.MV.ListOfDT SetAt() doesn't mention it though the doc for InsertAt() does: the value for POS needs to be between 1 and count()+1. You can't set an element that's more than 1 greater than count(). I think that's part of the fundamental definition of a "list" vs an "array"--you can only add at the end of a list, not past it. If you change the code to:
ST=pSource->PAYMENTSOURCE->SetAt('SOURCE',POS)
crt $SYSTEM.Status->GetErrorText(ST)
you should see:
ERROR #5820: Collection key '2' is invalid Because there isn't already an element 1.
I think the workaround would be to check the Count() on every property, and Insert() empty elements until they are all the same length as the key property PAYMENTAMT. (or write a method SetAtPad() which would do it)
> --
> You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
> To post to this group, send email to
Cac...@googlegroups.com
> To unsubscribe from this group, send email to
CacheMV-u...@googlegroups.com
> For more options, visit this group at
http://groups.google.com/group/CacheMV?hl=en