How to create 'List of Objects' in a Data Transformation?

Solapas principales

In my Data Transformation, the Target class needs to create a new List of objects (ListOfObj), depending on some conditions of Source class (Source/Target are completely distinct/different classes).

I experimented with Lists of 'primitive' data types (ListOfDT), and I could add new %String items (as an example) to a List of %String property, with "append" action in DT.

Does anyone have an example, or guidance, how to create new Lists of Objects in data transformation?

For example, if I have a 'container' class like this, it works:

Class Json.SalesOrderContainer Extends (%RegisteredObject,%XML.Adaptor)
{
    Property SalesOrderArray as List of %String; this works with append

However with List of Objects, it does not. It creates 'empty' Objects of the class, which is specified for List.
Here is the class structure:

Class Json.SalesOrderContainer Extends (%RegisteredObject,%XML.Adaptor)
{
    Property SalesOrderArray as List of SalesOrder;

Object class:

Class Json.SalesOrder Extends (%RegisteredObject,%XML.Adaptor)
{
    Property Reference As %String;
    
    Property SomeOtherReference As %String;
}

Observed, that SalesOrder elements are empty, and have no properties (Reference\SomeOtherReference), in Visual Trace:

I tried adding new SalesOrder elements with Code action in the Data Transformation, and also with For Each action

Appreciate any help!

-Nauris

Respuestas

Adding Working example for adding %String elements to List. Looking to do the same with complex objects

Not sure what the root cause was for the issue, but after some changes (in addition to using %Persistent XML classes, instead of %Registered) data transformation now works as intended. Resolved