Create new loops in DTL X12 Document

Hello,

I have a DTL to transform X12 Document 278 Request to 278 Response HIPAA 5010 schema. The DTL is called from BPL. I defined a class method that receives source, target, and context objects. How can I create 2000F loops in the response when there were none in the source object?

  • 0
  • 0
  • 69
  • 2
  • 0

Comments

Since I do not know how to create a new segment and then append to my target, I set x = target.OutputToString() and then append segments to my string as in Set x=x_"HL*5*4*0~...." and x=x_"SE*...~" and then set target=##class(EnsLib.EDI.X12.Document).ImportFromString(x).

I feel there should be a better way than doing string manipulation using Document Map etc.

I am working on DTL to transform X12 HIPAA_5010:278Review into HIPAA_5010:278Response.

My challenges are I do not know an elegant way to create multiple 2000E loops in the target. The source can have only one loop 2000E, I need to create as many 2000E loops as I find authorizations.

On top of that, I may need to create possibly hundreds of 2000F loops under one or more 2000E loops. The source may have zero or many 2000F loops.

The scenario I have been working on has zero 2000F loops and I need to create about 600 2000F loops in the target. Any guidance will be appreciated. I am not sure if subtransform will work because I can only create a Document or a Segment, not a Loop in a transformation.