Hi Jeff,

You need to traverse the array using the foreach action. The key of you array wil be the key of the OBXgrp. for the others group I'll assume that are fix with the key "1". Bellow a simple example. 

 <transform sourceClass='br.cjs.test.ArrayMessage' targetClass='EnsLib.HL7.Message' targetDocType='2.3.1:ORU_R01' create='new' language='objectscript' >
<foreach property='source.ArrayData()' key='k1' >
<assign value='source.ArrayData.(k1)' property='target.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(k1).OBX:SetIDOBX}' action='set' />
</foreach>
</transform>
}

Thanks Benjamin for the explanation,

Bellow the query in the INFORMATION_SCHEMA tables:

SELECT Tables.TABLE_SCHEMA, Tables.TABLE_NAME, Columns.COLUMN_NAME, Columns.DATA_TYPE
FROM INFORMATION_SCHEMA.TABLES AS Tables
INNER JOIN INFORMATION_SCHEMA.COLUMNS AS Columns 
   ON (Columns.TABLE_SCHEMA = Tables.TABLE_SCHEMA) AND (Columns.TABLE_NAME = Tables.TABLE_NAME)
WHERE (Tables.TABLE_SCHEMA = 'Sample') AND (Tables.TABLE_NAME = 'Person')
TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE
Sample Person ID integer
Sample Person Age integer
Sample Person DOB date
Sample Person FavoriteColors varchar
Sample Person Name varchar
Sample Person SSN varchar
Sample Person Spouse integer
Sample Person Home_City varchar
Sample Person Home_State varchar
Sample Person Home_Street varchar
Sample Person Home_Zip varchar
Sample Person Office_City varchar
Sample Person Office_State varchar
Sample Person Office_Street varchar
Sample Person Office_Zip varchar

Eric,

The problem is that ensemble do not recognized your Message Type, then in this case you can only access properties by Index.

In your case is segment 9 field 6: 

pRequest.GetValueAt("9:6")

To see the problem call the method GetValueAt and log the status code:

Do pRequest.GetValueAt("PIDgrpgrp(1).ORCgrp(1).OBXgrp(2).OBX:6", , .statusCode)

$$$LOGSTATUS(statusCode)

See de documentation for mor detail about message schema:

https://docs.intersystems.com/irisforhealthlatest/csp/docbook/Doc.View.cls?KEY=EHL72_tools
 

Hi Peter,

A very simple example:

/// Wrapper object
Class br.cjs.MtomObject Extends (%RegisteredObject, %XML.Adaptor)
{ 
Property BinaryData As %GlobalBinaryStream; 

/// Create a instance of br.cjs.MtomObject and populate the property BinaryData with th SVG logo of InterSystems Developer Community
ClassMethod GetLogo() As br.cjs.MtomObject
{
#Dim mtom As br.cjs.MtomObject = ##Class(br.cjs.MtomObject).%New()
#Dim logo As %Stream.TmpBinary = ##Class(%Stream.TmpBinary).%New()
//
b
Do logo.Write("<?xml version='1.0' encoding='utf-8'?>")
Do logo.Write("<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->")
Do logo.Write("<svg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px'")
Do logo.Write(" viewBox='0 0 181.9 45' style='enable-background:new 0 0 181.9 45;' xml:space='preserve'>")
Do logo.Write("<style type='text/css'>")
Do logo.Write(" .st0{fill:#27318A;}")
Do logo.Write(" .st1{fill:#27318B;}")
Do logo.Write(" .st2{fill:#00A99D;}")
Do logo.Write("</style>")
Do logo.Write("<g>")
Do logo.Write(" <path class='st0' d='M28.4,26.2h-3.8V5.7h3.8V26.2z'/>")
Do logo.Write(" <path class='st0' d='M43.7,26.2h-3.8v-8.6c0-2-1.4-2.9-2.8-2.9c-1.4,0-2.8,0.9-2.8,2.9v8.6h-3.8V11.5h3.8v1.3")
Do logo.Write(" c0.7-1,2.1-1.7,3.5-1.7c3,0,5.9,2.1,5.9,6.4C43.7,17.5,43.7,26.2,43.7,26.2z'/>")
Do logo.Write(" <path class='st0' d='M53.2,22.8v3.4h-3.6c-2.6,0-3.8-1.4-3.8-3.8v-7.6v-3.4V8.1h3.8v3.3h3.6v3.4h-3.6v6.8c0,0.7,0.2,1.2,1.1,1.2")
Do logo.Write(" C50.7,22.8,53.2,22.8,53.2,22.8z'/>")
Do logo.Write(" <path class='st0' d='M58.1,19.8L58.1,19.8c0,1.8,1,3,2.8,3c1.3,0,2.2-0.6,2.6-1.6h3.8c-0.6,3.1-2.8,5-6.4,5c-4.2,0-6.6-2.7-6.6-6.8")
Do logo.Write(" v-1.9c0-4.1,2.3-6.8,6.6-6.8c4.2,0,6.6,2.7,6.6,6.8v2.3C67.5,19.8,58.1,19.8,58.1,19.8z M58.1,16.7L58.1,16.7h5.6l0,0")
Do logo.Write(" c-0.1-1.5-1.1-2.5-2.8-2.5C59.3,14.2,58.3,15.2,58.1,16.7z'/>")
Do logo.Write(" <path class='st0' d='M73.4,26.2h-3.8V11.5h3.8v1.6c0.4-1,1.7-1.9,3.4-1.9H78v3.7h-1.8c-1.4,0-2.8,0.9-2.8,2.9")
Do logo.Write(" C73.4,17.8,73.4,26.2,73.4,26.2z'/>")
Do logo.Write(" <path class='st0' d='M79.8,19.6h3.9c0.2,1.7,1.5,2.8,3.5,2.8c1.7,0,2.9-0.6,2.9-2c0-1.1-0.7-1.7-2.1-2.1l-3.4-0.9")
Do logo.Write(" c-3.1-0.8-4.6-3-4.6-5.9c0-4,3.1-5.8,6.6-5.8c4,0,6.5,2.3,6.9,5.7h-3.9c-0.3-1.3-1.7-1.9-3-1.9c-1.6,0-2.7,0.6-2.7,2")
Do logo.Write(" c0,1.2,0.9,1.7,2,2l3.3,0.9c3.1,0.8,4.7,2.7,4.7,6.1c0,3.6-2.3,5.8-6.7,5.8C82.8,26.2,80,23.6,79.8,19.6z'/>")
Do logo.Write(" <path class='st0' d='M103,27.5c-0.8,2.2-1,3.9-3.7,3.9h-2.8V28h1.6c0.7,0,0.9-0.3,1-0.7l0.4-1.2l-5.3-14.7h4l3.3,9.4l3.3-9.4h4")
Do logo.Write(" L103,27.5z'/>")
Do logo.Write(" <path class='st0' d='M108.5,21.2h3.8c0.2,1.1,1.5,1.7,2.7,1.7c0.7,0,1.9-0.2,1.9-1.1c0-0.6-0.4-0.9-1.3-1.1l-3.1-0.7")
Do logo.Write(" c-1.6-0.4-3.6-1.6-3.6-4.5s2.6-4.5,5.6-4.5s5.5,1.4,5.7,4.8h-3.9c-0.2-0.9-1-1.4-2-1.4c-1.1,0-1.7,0.4-1.7,1.1")
Do logo.Write(" c0,0.6,0.5,0.9,1.1,1.1l3.3,0.7c1.6,0.4,3.6,1.5,3.6,4.5c0,3.3-2.7,4.5-5.7,4.5C111.8,26.2,108.6,24.6,108.5,21.2z'/>")
Do logo.Write(" <path class='st0' d='M134.6,19.8L134.6,19.8c0,1.8,1,3,2.8,3c1.3,0,2.2-0.6,2.6-1.6h3.8c-0.6,3.1-2.8,5-6.4,5")
Do logo.Write(" c-4.2,0-6.6-2.7-6.6-6.8v-1.9c0-4.1,2.3-6.8,6.6-6.8c4.2,0,6.6,2.7,6.6,6.8v2.3C144,19.8,134.6,19.8,134.6,19.8z M134.6,16.7")
Do logo.Write(" L134.6,16.7h5.6l0,0c-0.1-1.5-1.1-2.5-2.8-2.5S134.8,15.2,134.6,16.7z'/>")
Do logo.Write(" <path class='st0' d='M159.1,26.2h-3.8v-8.6c0-2-1.4-2.9-2.7-2.9s-2.7,0.9-2.7,2.9v8.6h-3.8V11.5h3.8v1.2c0.7-1,2.1-1.6,3.3-1.6")
Do logo.Write(" c1.5,0,2.9,0.6,4,1.9c1.1-1.3,2.6-1.9,4.6-1.9c3.7,0,6.5,2.1,6.5,6.4v8.7h-3.8v-8.6c0-2-1.4-2.9-2.7-2.9s-2.7,0.9-2.7,2.9")
Do logo.Write(" L159.1,26.2L159.1,26.2z'/>")
Do logo.Write(" <path class='st0' d='M169.7,21.2h3.8c0.2,1.1,1.5,1.7,2.7,1.7c0.7,0,1.9-0.2,1.9-1.1c0-0.6-0.4-0.9-1.3-1.1l-3.1-0.7")
Do logo.Write(" c-1.6-0.4-3.6-1.6-3.6-4.5s2.6-4.5,5.6-4.5s5.5,1.4,5.7,4.8h-3.9c-0.2-0.9-1-1.4-2-1.4c-1.1,0-1.7,0.4-1.7,1.1")
Do logo.Write(" c0,0.6,0.5,0.9,1.1,1.1l3.3,0.7c1.6,0.4,3.6,1.5,3.6,4.5c0,3.3-2.7,4.5-5.7,4.5C173.1,26.2,169.9,24.6,169.7,21.2z'/>")
Do logo.Write(" <path class='st0' d='M129.2,22.8v3.4h-3.6c-2.6,0-3.8-1.4-3.8-3.8v-7.6v-3.4V8.1h3.8v3.3h3.6v3.4h-3.6v6.8c0,0.7,0.2,1.2,1.1,1.2")
Do logo.Write(" C126.7,22.8,129.2,22.8,129.2,22.8z'/>")
Do logo.Write("</g>")
Do logo.Write("<g>")
Do logo.Write(" <polygon class='st1' points='5.6,6.3 0,3.5 0,39.3 11.3,45 11.3,38.7 5.6,35.9 '/>")
Do logo.Write(" <polygon class='st2' points='11.3,38.7 16.9,41.5 16.9,5.7 5.6,0 5.6,6.3 11.3,9.1 '/>")
Do logo.Write("</g>")
Do logo.Write("<g>")
Do logo.Write(" <path class='st0' d='M24.3,41v-8h3c1.9,0,3,1.2,3,3v2.1c0,1.8-1.1,3-3,3H24.3z M28.9,36c0-0.9-0.7-1.4-1.5-1.4h-1.5v5h1.5")
Do logo.Write(" c0.8,0,1.5-0.5,1.5-1.4V36z'/>")
Do logo.Write(" <path class='st0' d='M32.9,38.6L32.9,38.6c0,0.7,0.4,1.2,1.1,1.2c0.5,0,0.9-0.3,1-0.7h1.5c-0.2,1.2-1.1,2-2.6,2")
Do logo.Write(" c-1.7,0-2.6-1.1-2.6-2.7v-0.8c0-1.6,0.9-2.7,2.6-2.7c1.7,0,2.6,1.1,2.6,2.7v0.9H32.9z M32.9,37.3L32.9,37.3l2.2,0v0")
Do logo.Write(" c0-0.6-0.4-1-1.1-1C33.4,36.3,33,36.7,32.9,37.3z'/>")
Do logo.Write(" <path class='st0' d='M41.3,35.1h1.6L40.8,41h-1.6l-2.1-5.9h1.6l1.3,3.8L41.3,35.1z'/>")
Do logo.Write(" <path class='st0' d='M44.8,38.6L44.8,38.6c0,0.7,0.4,1.2,1.1,1.2c0.5,0,0.9-0.3,1-0.7h1.5c-0.2,1.2-1.1,2-2.6,2")
Do logo.Write(" c-1.7,0-2.6-1.1-2.6-2.7v-0.8c0-1.6,0.9-2.7,2.6-2.7c1.7,0,2.6,1.1,2.6,2.7v0.9H44.8z M44.8,37.3L44.8,37.3l2.2,0v0")
Do logo.Write(" c0-0.6-0.4-1-1.1-1C45.3,36.3,44.9,36.7,44.8,37.3z'/>")
Do logo.Write(" <path class='st0' d='M52,39.7V41h-0.7c-1.1,0-1.5-0.6-1.5-1.5V33h1.5v6.2c0,0.3,0.1,0.5,0.4,0.5H52z'/>")
Do logo.Write(" <path class='st0' d='M52.8,37.7c0-1.6,0.9-2.7,2.6-2.7c1.7,0,2.6,1.1,2.6,2.7v0.8c0,1.6-0.9,2.7-2.6,2.7c-1.7,0-2.6-1.1-2.6-2.7")
Do logo.Write(" V37.7z M56.5,37.5c0-0.7-0.4-1.2-1.1-1.2c-0.7,0-1.1,0.5-1.1,1.2v1.1c0,0.7,0.4,1.2,1.1,1.2c0.7,0,1.1-0.5,1.1-1.2V37.5z'/>")
Do logo.Write(" <path class='st0' d='M60.8,43.2h-1.5v-8h1.5v0.5c0.3-0.4,0.9-0.7,1.4-0.7c1.2,0,2.4,0.8,2.4,2.6v1.1c0,1.7-1.2,2.6-2.4,2.6")
Do logo.Write(" c-0.5,0-1.1-0.3-1.4-0.7V43.2z M63,37.6c0-0.8-0.6-1.1-1.1-1.1s-1.1,0.3-1.1,1.1v0.9c0,0.8,0.6,1.1,1.1,1.1s1.1-0.3,1.1-1.1V37.6z'")
Do logo.Write(" />")
Do logo.Write(" <path class='st0' d='M67.1,38.6L67.1,38.6c0,0.7,0.4,1.2,1.1,1.2c0.5,0,0.9-0.3,1-0.7h1.5c-0.2,1.2-1.1,2-2.6,2")
Do logo.Write(" c-1.7,0-2.6-1.1-2.6-2.7v-0.8c0-1.6,0.9-2.7,2.6-2.7c1.7,0,2.6,1.1,2.6,2.7v0.9H67.1z M67.1,37.3L67.1,37.3l2.2,0v0")
Do logo.Write(" c0-0.6-0.4-1-1.1-1C67.5,36.3,67.1,36.7,67.1,37.3z'/>")
Do logo.Write(" <path class='st0' d='M73.5,41H72v-5.9h1.5v0.6c0.2-0.4,0.7-0.7,1.4-0.7h0.5v1.5h-0.7c-0.6,0-1.1,0.3-1.1,1.1V41z'/>")
Do logo.Write(" <path class='st0' d='M84.4,38.4c-0.1,1.7-1.2,2.8-3,2.8c-1.9,0-3-1.2-3-3v-2.3c0-1.8,1.1-3,3-3c1.9,0,3,1.1,3,2.8h-1.5")
Do logo.Write(" c-0.1-0.8-0.7-1.3-1.5-1.3c-0.8,0-1.5,0.5-1.5,1.4v2.3c0,0.9,0.7,1.4,1.5,1.4c0.8,0,1.4-0.4,1.5-1.3H84.4z'/>")
Do logo.Write(" <path class='st0' d='M85.3,37.7c0-1.6,0.9-2.7,2.6-2.7c1.7,0,2.6,1.1,2.6,2.7v0.8c0,1.6-0.9,2.7-2.6,2.7c-1.7,0-2.6-1.1-2.6-2.7")
Do logo.Write(" V37.7z M89.1,37.5c0-0.7-0.4-1.2-1.1-1.2c-0.7,0-1.1,0.5-1.1,1.2v1.1c0,0.7,0.4,1.2,1.1,1.2c0.7,0,1.1-0.5,1.1-1.2V37.5z'/>")
Do logo.Write(" <path class='st0' d='M97,41h-1.5v-3.4c0-0.8-0.6-1.1-1.1-1.1c-0.5,0-1.1,0.4-1.1,1.1V41h-1.5v-5.9h1.5v0.5c0.3-0.4,0.8-0.7,1.3-0.7")
Do logo.Write(" c0.6,0,1.2,0.2,1.6,0.8c0.4-0.5,1-0.8,1.8-0.8c1.5,0,2.6,0.8,2.6,2.6V41h-1.5v-3.4c0-0.8-0.5-1.1-1.1-1.1c-0.5,0-1.1,0.4-1.1,1.1")
Do logo.Write(" V41z'/>")
Do logo.Write(" <path class='st0' d='M107.2,41h-1.5v-3.4c0-0.8-0.6-1.1-1.1-1.1c-0.5,0-1.1,0.4-1.1,1.1V41H102v-5.9h1.5v0.5")
Do logo.Write(" c0.3-0.4,0.8-0.7,1.3-0.7c0.6,0,1.2,0.2,1.6,0.8c0.4-0.5,1-0.8,1.8-0.8c1.5,0,2.6,0.8,2.6,2.6V41h-1.5v-3.4c0-0.8-0.5-1.1-1.1-1.1")
Do logo.Write(" c-0.5,0-1.1,0.4-1.1,1.1V41z'/>")
Do logo.Write(" <path class='st0' d='M115.8,38.5v-3.4h1.5V41h-1.5v-0.6c-0.3,0.4-0.7,0.8-1.4,0.8c-1.1,0-2.3-0.8-2.3-2.6v-3.5h1.5v3.4")
Do logo.Write(" c0,0.8,0.5,1.1,1.1,1.1C115.3,39.7,115.8,39.3,115.8,38.5z'/>")
Do logo.Write(" <path class='st0' d='M124,41h-1.5v-3.4c0-0.8-0.5-1.1-1.1-1.1s-1.1,0.3-1.1,1.1V41h-1.5v-5.9h1.5v0.5c0.3-0.4,0.9-0.7,1.4-0.7")
Do logo.Write(" c1.2,0,2.4,0.8,2.4,2.6V41z'/>")
Do logo.Write(" <path class='st0' d='M126.8,34.4h-1.5V33h1.5V34.4z M126.8,41h-1.5v-5.9h1.5V41z'/>")
Do logo.Write(" <path class='st0' d='M131.4,39.7V41h-1.5c-1.1,0-1.5-0.6-1.5-1.5v-3h-0.8v-1.4h0.8v-1.3h1.5v1.3h1.5v1.4h-1.5v2.7")
Do logo.Write(" c0,0.3,0.1,0.5,0.4,0.5H131.4z'/>")
Do logo.Write(" <path class='st0' d='M135.1,41.6c-0.3,0.9-0.4,1.5-1.5,1.5h-1.1v-1.4h0.6c0.3,0,0.4-0.1,0.4-0.3l0.2-0.5l-2.1-5.9h1.6l1.3,3.8")
Do logo.Write(" l1.3-3.8h1.6L135.1,41.6z'/>")
Do logo.Write("</g>")
Do logo.Write("</svg>")
//
Do mtom.BinaryData.CopyFrom(logo)
//
Return mtom
} 
}

/// WebService
Class br.cjs.MtomServiceSoap Extends %SOAP.WebService
{ 
Method GetLogo() As %GlobalBinaryStream [ WebMethod ]
{
/// Tell to the service that the return of method is a attachment
Set ..MTOMRequired = 1
//
#Dim mtom As br.cjs.MtomObject = ##Class(br.cjs.MtomObject).GetLogo()
//
Return mtom.BinaryData
} /// SERVICENAME - Should be the name of the service for which this is a proxy.
/// Override this parameter in the subclass.
Parameter SERVICENAME = "MtomServiceExample"; /// NAMESPACE - Should be an unique URI
/// Override this parameter in the subclass with the unique namespace URI
/// of your organization.
/// Override this parameter in the subclass.
Parameter NAMESPACE = "br.cjs"; 
}

The global ^PAADMi("No", "") is a index global, if I'm not wrong ,is a index of PA_AADM table and the field of the index is PAADM_PAPMI_NO (MRN number of patient).  Maybe then idex have some problem.

Do you have access to the stored procedure code?, If yes try to execute the query of procedure manually in the System Adminstration Portal. If not, I think you will need some suport.

Hi Abel,

When we subclass a persistent class and we need that this subclass have a own storage we need to add in the inheritance class list the %Persistent class  first of all classes.

Shared storage

 Class sample.MyHL7 Extends EnsLib.HL7.Message
{ 

Storage Default
{
<Type>%Library.CacheStorage</Type>
}

}

Own storage

 Class sample.MyHL7 Extends (%Persistent, EnsLib.HL7.Message)
{ 

Storage Default
{
<Data name="MyHL7DefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>ParentId</Value>
</Value>
<Value name="3">
<Value>DocType</Value>
</Value>
<Value name="4">
<Value>Envelope</Value>
</Value>
<Value name="5">
<Value>Source</Value>
</Value>
<Value name="6">
<Value>IsMutable</Value>
</Value>
<Value name="7">
<Value>OriginalDocId</Value>
</Value>
<Value name="8">
<Value>MessageTypeCategory</Value>
</Value>
<Value name="9">
<Value>TimeCreated</Value>
</Value>
</Data>
<Data name="UserValues">
<Attribute>UserValues</Attribute>
<Structure>subnode</Structure>
<Subscript>"UserValues"</Subscript>
</Data>
<DataLocation>^sample.MyHL7D</DataLocation>
<DefaultData>MyHL7DefaultData</DefaultData>
<IdLocation>^sample.MyHL7D</IdLocation>
<IndexLocation>^sample.MyHL7I</IndexLocation>
<StreamLocation>^sample.MyHL7S</StreamLocation>
<Type>%Library.CacheStorage</Type>
} 

}

Hi Davi,

A simplest way is creating a datatype class:

 Class system.dto.sector.SectorStatusEnum Extends %Integer [ ClassType = datatype ]
{
 
Parameter DISPLAYLIST = ",Active,Inactive,Production,Upkeep,NewValue";

Parameter VALUELIST = ",1,2,3,4,5"; 

}

And use the datatype in your class:

Class system.dto.sector.Test Extends %Persistent
{ 

Property SectorStatus As SectorStatusEnum;

}

Example:

Hi Javier, 

A some years ago I wrote a class to copy from to object. Is a simple data tranformation that reads the definition of source object and try to set the target object.

Is a very simple copy, without care about with types, I use for save time when I need to copy many properties of source object  to target object.

Recently I adapted the code to consider the source objects that are dynamic objects.

Works similar to the method from JSON that Chris wrote in the post.

The code was written in portuguese (Brazil) I hope can be useful to you.

/// <p>
/// <b>2012-03-01 - Cristiano José da Silva</b><br/>
/// Classe utilizada para copiar todas propriedades de um objeto origem para um objeto destino.<br/>
/// Esse método não se comporta como o %ConstructClone, pois ele copia os dados de origem para um 
/// destino mesmo sendo de tipos diferentes. Ele foi implementado para poder copiar objetos de tipos 
/// diferentes mas com a mesma definição.<br/>
/// A definição mandatória é a da origem, isto é, caso o objeto destino possua um referência para outro
/// objeto, e no objeto origem essa mesma propriedade seja uma string, o objeto destino receberá uma string 
/// no lugar de uma referência.<br/>
/// Caso queira ignorar uma ou mais propriedade passa-las em no array pProriedadesAIgnorar indexao pelo nome 
/// da propriedade Ex:
/// <example>
/// Set tPropriedadesIgnoradas("Prop1") = 1
/// Set tPropriedadesIgnoradas("PropN") = 1
/// </example>
/// <strong>
/// Os nomes das propriedades devem ser exatamente iguais nas duas classes.</br>
/// Os tipos também devem ser os mesmos para evitar erros.
/// </strong><br/>
/// </p>
Class cjs.dt.CopiarObjetoDT Extends Ens.DataTransform [ ProcedureBlock ]
{

ClassMethod Transform(pSource As %RegisteredObject, pTarget As %RegisteredObject, ByRef pProriedadesIgnoradas) As %Status
{
    #Dim tException As %Exception.General
    #Dim tStatus As %Status = $System.Status.OK() 
    Try
    {
        If ($IsObject($Get(pSource)) '= 1) 
        {
            Set tStatus = $System.Status.Error(5001, "Objeto origem é obrigatório")
            //
            Quit
        }
        If ($IsObject($Get(pTarget)) '= 1) 
        {
            Set tStatus = $System.Status.Error(5001, "Objeto destino é obrigatório")
            //
            Quit
        }
        // Trata Objetos Dinâmicos (JSON)
        If (pSource.%IsA("%Object"))
        {
            #Dim tIterator As %Iterator.AbstractIterator = pSource.$getIterator()
            #Dim tChave As %String = ""
            #Dim tValor As %String = ""
            //
            While (tIterator.$getNext(.tChave, .tValor))
            {
                If ($Data(pProriedadesIgnoradas))
                {
                    Continue:($Get(pProriedadesIgnoradas(tChave), 0))
                }
                Set $Property(pTarget, tChave) = tValor
            }
        }
        Else
        {
            Set tDefinicaoClasse                   = ##Class(%Dictionary.CompiledClass).%OpenId(pSource.%ClassName(1))
            #Dim tPropriedades As %ArrayOfObjects  = tDefinicaoClasse.Properties
            #Dim tIndicePropriedade As %Integer    = 0
            //
            For tIndicePropriedade = 1 : 1 : tPropriedades.Count()
            { 
                #Dim tPropriedade As %Dictionary.CompiledProperty = tPropriedades.GetAt(tIndicePropriedade)
                //
                Continue:(tPropriedade.Private || tPropriedade.ReadOnly || tPropriedade.Calculated || tPropriedade.Transient)
                //
                #Dim tNomePropriedade As %String = tPropriedade.Name
                //
                If ($Data(pProriedadesIgnoradas))
                {
                    Continue:($Get(pProriedadesIgnoradas(tNomePropriedade), 0))
                }
                Set $Property(pTarget, tNomePropriedade) = $Property(pSource, tNomePropriedade)
            }
        }
    }
    Catch (tException)
    {
        Set tStatus = tException.AsStatus()
    }
    Return tStatus
}

ClassMethod Teste()
{
    Write !, "Teste ambos sendo um objeto registrado", !
    //
    Set tOrigem             = ##Class(Ens.StringContainer).%New()
    Set tOrigem.StringValue = "Ambos registrado."
    Set tDestino            = ##Class(Ens.StringContainer).%New()
    //
    Do ..Transform(tOrigem, tDestino)
    //
    Write tDestino.StringValue, !
    Write !, "Teste da origem sendo um objeto dinâmico", !
    //
    Set tOrigem             = ##Class(%Object).%New()
    Set tOrigem.StringValue = "Origem dinâmico"
    Set tDestino            = ##Class(Ens.StringContainer).%New()
    //
    Do ..Transform(tOrigem, tDestino)
    //
    Write tDestino.StringValue, !
    Write !, "Teste da destino sendo um objeto dinâmico", !
    //
    Set tOrigem             = ##Class(Ens.StringContainer).%New()
    Set tOrigem.StringValue = "Destino dinâmico"
    Set tDestino            = ##Class(%Object).%New()
    //
    Do ..Transform(tOrigem, tDestino)
    //
    Write tDestino.StringValue, !
    Write !, "Teste ambos sendo um objeto dinâmico", !
    //
    Set tOrigem             = ##Class(%Object).%New()
    Set tOrigem.StringValue = "Ambos dinâmico"
    Set tDestino            = ##Class(%Object).%New()
    //
    Do ..Transform(tOrigem, tDestino)
    //
    Write tDestino.StringValue, !
}

}