Question
· Jun 28, 2016

simplest 835 transform returns "unrecognized segment IAS found after segment 0"

Hello Community,

I am trying to create a simple Ensemble DTL transform using the GUI.  In order to test something very simple, I have created a transform that does nothing.  

 

I'm using test data from here: https://www.emedny.org/HIPAA/5010/5010_sample_files/835%20Sample%20(Institutional%20Claims%20only).2014.txt

 It's a very small test 835 file.

 

My transform looks like this in the compiled class:

<transform sourceClass='EnsLib.EDI.X12.Document' targetClass='EnsLib.EDI.X12.Document' sourceDocType='HIPAA_5010:835' targetDocType='HIPAA_5010:835' create='copy' language='objectscript' >
<if condition='source.{loop1000A.N1:Name}="NYSDOH"' >
<true/>
<false/>
</if>
</transform>

See - It does nothing.

 

Using the test data fromthe above link, I get this error: 'ERROR <EnsEDI>ErrMapSegUnrecog: Unrecognized Segment ISA found after segment 0'

 

I get this error lots of different ways, trying lots of different actions on the transform.  

Why would the ISA segment not be recognized?  I tried different source and target classes, with worse consequences. 

Any ideas?

 

Thanks,

Laura

Discussion (7)0
Log in or sign up to continue

Laura

your sample file is a an interchange (look for the ISA and IEA segments) that include one group (see the GS and GE segments) that in turn contains one 835 message (look for the ST and SE segments).

An interchange can contain multiple groups which typically contain many individual transactions.

You should just copy the ST and SE segments and all in between and use that to test your 835 transformation.

You can then create transformations on the interchange and the group and loop through all the individual transactions calling your DTL as subtransformations. I think this is documented but it has got easier in the last few years so hopefully you are on a modern release.

Alternatively, because people want the same simple changes to the interchange and group segments for all X12 transactions people often just write than bit in object script.

Ask again if you don't find the documetnation

dave

David, Yes, removing the ISA and GS segments (and corresponding GE and IEA lines) worked.  The test returns results.  That's all I needed to see.  And again, I assume that the actual transform, in the production or whenever I actually run it, won't need this.  Otherwise I'll need a transform before I run my transform.  Ooh - perhaps that's what you meant by a having to call a subtransform.  

Well, I'll keep that  in mind.

Thank you,

laura

you have to be on 2015.1 to have a pure DTL transform of an X12 interchange.

On 2014.1 you will have to use object script to loop over the child documents of the interchange to get the groups and then loop over the child documents of the groups to get the  actual documents. I can't find an example right now, but hopefully another reader can point you to one. 

I'm working on an Interchange loop, which calls a subtransform on a Group, which calls a subtransform on an 835 document.  The TEST button/data returns segments (i.e. no errors), but I can't quite tell if  it's creating a new target with the properly transformed data.  I'd be happy to share the transforms on this thread if anyone would like to see them.  I'd love to know if I'm doing it correctly.

Thank you,

Laura

Hi David,

 

I'm resonding to your comment " I think this is documented "; I found the below link int he documentation, but an entire section in the documentation was copied and pasted, incorrectly.  

 

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

 

 

This part doesn't make sense: 

"Create a new Data Transformation (emphasis added because the below instructions are for creating an array of groups which is the next step)

  1. Create a new set action by clicking Add Action and selecting set.

  2.  Input a variable name into the Property field, such as ArrayOfGroups.

  3.  Input ##class(%Library.VariableName).%New() into the Value field, where VariableName is the value you provided in the Property field.

  4.  Input "" into the Key field."

but I can't quite figure out what it was supposed to be. In fact, inthe next step, Creating An Array of Groups, the steps above don't work anyway. 

 

This is basically what I was doing with my Interchange loop, which calls the Group loop, which calls the subtransform. The interchange transform runs, but I end up with the ISA line and the IEA line, and nothing else in between. Not quite true: I end up with a reference to a GroupDocsRef in between.  My output file has just two lines however.

 

Anyone else have an idea?  Any examples of an Ensemble 835 DTL transform at a transaction level that I somehow missed on the web?

 

Thanks,

Laura

David was correct in that I had to use object script to loop through the interchange (ISA segment) and the groups (GS segment). I was able to put that code right into the transform.  Since I'm on 2014.1.3 I had to add this code, rather than using the transformation to loop.

 

The code looks like this:

s GroupIn = ""
  for {
  
    s GroupIn=source.NextChild(GroupIn,source.GetSegmentIndex("GroupDocsRef",.ok))
  
    Quit:'$IsObject(GroupIn)
    s tSC =GroupIn.PokeDocType("HIPAA_5010:Group")
    s tSC=GroupIn.BuildMap()
     
    s TSIn=""
    
    For {
     Set TSIn=GroupIn.NextChild(TSIn,GroupIn.GetSegmentIndex("TransactionSetDocsRef",.ok))
     
     Quit:'$IsObject(TSIn)
     s tSC =TSIn.PokeDocType("HIPAA_5010:835")
     
     s TSOut = ""

 

The transformation that has the code in it looks like this:

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl]
{
<transform sourceClass='EnsLib.EDI.X12.Document' targetClass='EnsLib.EDI.X12.Document' sourceDocType='HIPAA_5010:Interchange' targetDocType='HIPAA_5010:Interchange' create='copy' language='objectscript' >
<annotation>This sorts the Transaction Sets from an Interchange into Groups. It also calls a transform on the Transaction Sets. Much of this was copied from the Demo.X12.SorterDTL.ByGroup.SorterTransform.dtl in the 2016 ENSDEMO namespace.</annotation>
<assign value='0' property='target.{GroupDocsRef:ChildCount}' action='set' >
<annotation>Initiate the child count in the Interchange to zero</annotation>
</assign>
<assign value='0' property='target.{IEA:NumberofIncludedFunctionalGr}' action='set' >
<annotation>Initiate the child count in the Interchange to zero</annotation>
</assign>
<assign value='##class(%Library.ArrayOfObjects).%New()' property='ArrayOfGroups' action='set' >
<annotation>Create the array of Groups</annotation>
</assign>
<code>
<![CDATA[ s GroupIn = ""
  for {
  
    s GroupIn=source.NextChild(GroupIn,source.GetSegmentIndex("GroupDocsRef",.ok))
  
    Quit:'$IsObject(GroupIn)
    s tSC =GroupIn.PokeDocType("HIPAA_5010:Group")
    s tSC=GroupIn.BuildMap()
     
    s TSIn=""
    
    For {
     Set TSIn=GroupIn.NextChild(TSIn,GroupIn.GetSegmentIndex("TransactionSetDocsRef",.ok))
     
     Quit:'$IsObject(TSIn)
     s tSC =TSIn.PokeDocType("HIPAA_5010:835")
     
     s TSOut = ""]]></code>
<subtransform class='My835Transform' targetObj='TSOut' sourceObj='TSIn' >
<annotation>Transform the transaction set </annotation>
</subtransform>
<assign value='TSOut.{BPR:TransactionHandlingCode}' property='key' action='set' />
<assign value='##class(HelperMethods).FindParents(TSOut,GroupIn,ArrayOfGroups,,key)' property='tSC' action='set' />
<code>  <-- another code snippit to finish the for loops
<![CDATA[ }
  }]]></code>  
<foreach property='ArrayOfGroups' key='tKey' >
<assign value='ArrayOfGroups.GetAt(tKey)' property='tGroupOut' action='set' />
<assign value='##class(HelperMethods).AddChildToDocsRef(tGroupOut,target,"GroupDocsRef")' property='tSC' action='set' />
</foreach>
</transform>

 

Note that it was all done using the GUI that Intersystems provides for editing a transform (in Management Portal or Studio). I copied most of the transform from Demo.X12.SorterDTL.ByGroup.SorterTransform in 2016 which I had to download to my personal computer in order to have the demo; I mostly copied the 2016 demo transform called Demo.X12.SorterDTL.byGroup.SorterTransform.dtl.

 

Apparently the looping in 2014 uses  EnsLib.EDI.X12.Document.GetNextIndex, which does not work, while in 2016 the looping uses Document.NextChild, which does work.  Hence, the code insertion in this 2014 transform.

 

I might be able to help anyone with questions about it, although InterSystems is very good at responding to WRC ticket requests.

 

Thanks go to Michael Breen at IS.

 

Laura