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>
}

Hi Robert,

Have you tired to export in UDL format (the UDL format is the document that we edit in Studio, VSCode, or in Atelier) via classmethod ExportUDL from the class %SYSTEM.OBJ

https://docs.intersystems.com/irisforhealth20201/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25SYSTEM.OBJ#METHOD_ExportUDL

To import you can use the classmethods Load, LoadDir  or any other method that load code from disk,. Or you can import from Studio to.

https://docs.intersystems.com/irisforhealth20201/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25SYSTEM.OBJ#METHOD_Load

For me worked export from:

IRIS for Windows (x86-64) 2020.1 (Build 215U) Mon Mar 30 2020 20:14:44 EDT

And import in:

Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2017.2.2 (Build 865U) Mon Jun 25 2018 10:50:02 EDT

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

Hi Meenakshi,

In the package %Dictionary you can query all information about classes.

To list all properties before compilation (columns):

SELECT Class.Name AS ClassName, Prop.Name AS PropertyName,  Prop.Type 
FROM %Dictionary.ClassDefinition AS Class
INNER JOIN %Dictionary.PropertyDefinition AS Prop ON Prop.parent = Class.%ID
WHERE Class.Name = 'Sample.Person'
ClassName PropertyName Type
Sample.Person Age %Integer
Sample.Person DOB %Date
Sample.Person FavoriteColors %String
Sample.Person Home Address
Sample.Person Name %String
Sample.Person Office Address
Sample.Person SSN %String
Sample.Person Spouse Person

To list all properties after compilation (columns):

SELECT Class.Name AS ClassName, Prop.Name AS PropertyName, Prop.Type 
FROM %Dictionary.CompiledClass AS Class
INNER JOIN %Dictionary.CompiledProperty AS Prop ON Prop.parent = Class.%ID
WHERE Class.Name = 'Sample.Person'
ClassName PropertyName Type
Sample.Person %%OID %Library.CacheString
Sample.Person %Concurrency %Library.CacheString
Sample.Person Age %Library.Integer
Sample.Person DOB %Library.Date
Sample.Person FavoriteColors %Library.String
Sample.Person Home Sample.Address
Sample.Person Name %Library.String
Sample.Person Office Sample.Address
Sample.Person SSN %Library.String
Sample.Person Spouse Sample.Person

Hi Thembelani

If I understood, you don't want to project the SerialC. If is this, remove the %XML.Adaptor from the Extends class list.

You can set in the Business Service the Setting: MessageSchemaCategory and then the Ensemble will recognize your message and map all properties.

I hope be helped you.

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
 

It's correct, you can use index or name of a field.

Are you sure about the value of a field?

Could you post the entire HL7 message?

Hi Eric,

In ORM messages the property path is:

"ORCgrp(<indexORC>).OBRuniongrp.OBXgrp(<indexOBX>).OBX"

Where <indexORC> is the "line" of ORC segment, the <indexOBX> is the same to OBX segment, generally we iterate over a loop.

In ORU messages the property  path is:

"PIDgrpgrp(<indexPID>).ORCgrp(<indexORC>).OBXgrp(<indexOBX>).OBX"

Then indexes variables is analogous to the ORM messages.

The easy way to you "discover" the property  path is creating a DTL data transformation  and map the property that you need in a fake assign action, save, compile and change to the generated routine (in studio use the shortcut Ctrl+Shift+V, 2 times)