Converting X12 270 XML transaction to EDI

May 10, 2012 at 4:13 PM

Hi,

I want to convert the 270 XML starting from ST segment to EDI format with ISA segment and GS segments. In short X12 parser should give me complete 270 request in EDI format. It is possible? If yes, Kindly reply with the code.

Thanks and Regards,

Dinesh Arora.

Coordinator
May 10, 2012 at 4:38 PM

There is a method called TransformToX12 that will take the xml that is created by the parser and transform it back to X12..

There is a unit test that actually runs all the test data through this method to make sure the result is the same as the original:

Stream stream = GetEdi(resourcePath);

var parser = new X12Parser();
Interchange interchange = parser.ParseMultiple(stream).First();
string originalX12 = interchange.SerializeToX12(true);

string xml = interchange.Serialize();
string x12 = parser.TransformToX12(xml);

Interchange newInterchange = parser.ParseMultiple(x12).First();
string newX12 = newInterchange.SerializeToX12(true);

Assert.AreEqual(originalX12, newX12);
Trace.Write(x12);

May 23, 2012 at 2:41 PM

Hi,

 

I tried this code, but my problem is my 270 Request is like following and I need ISA segment to be generated by X12 parser by using following as the Input.

 

<?xml version="1.0"?>
      <ST>
        <ST01>270</ST01>
        <ST02>51492</ST02>
      </ST>
      <BHT>
        <BHT01>0022</BHT01>
        <BHT02>13</BHT02>
        <BHT03>4306773</BHT03>
        <BHT04>20120502</BHT04>
        <BHT05>092958</BHT05>
      </BHT>
      <HierarchicalLoop LoopId="2000A" LoopName="Information Source Level" Id="1" ParentId="">
        <HL>
          <HL01>1</HL01>
          <HL02 />
          <HL03>20</HL03>
          <HL04>1</HL04>
        </HL>
        <Loop LoopId="2100A" Name="Information Source Name">
          <NM1>            
            <NM101>PR</NM101>
            <NM102>2</NM102>
            <NM103>XYZ ABC</NM103>
            <NM104 />
            <NM105 />
            <NM106 />
            <NM107 />
            <NM108>PI</NM108>
            <NM109>BCBSF</NM109>
          </NM1>
        </Loop>
        <HierarchicalLoop LoopId="2000B" LoopName="Information Receiver Level" Id="2" ParentId="1">
          <HL>
	    <HL01>2</HL01>           
            <HL02>1</HL02>
            <HL03>21</HL03>
            <HL04>1</HL04>
          </HL>
          <Loop LoopId="2100B" Name="Information Receiver Name">
            <NM1>
              <NM101>1P</NM101>
              <NM102>1</NM102>
              <NM103 />
              <NM104 />
              <NM105 />
              <NM106 />
              <NM107 />
              <NM108>XX</NM108>
              <NM109>1417092493</NM109>
            </NM1>
          </Loop>
          <HierarchicalLoop LoopId="2000C" LoopName="Subscriber Level" Id="3" ParentId="2">
            <HL>
              <HL01>3</HL01>
              <HL02>2</HL02>
              <HL03>22</HL03>
              <HL04>1</HL04>
            </HL>
            <Loop LoopId="2100C" Name="Subscriber Name">
              <NM1>
                <NM101>IL</NM101>
                <NM102>1</NM102>
                <NM103 />
                <NM104 />
                <NM105 />
                <NM106 />
                <NM107 />
                <NM108>MI</NM108>
                <NM109>XJJH28582075</NM109>
              </NM1>
            </Loop>
            <HierarchicalLoop LoopId="2000D" LoopName="Dependent Level" Id="4" ParentId="3">
              <HL>
                <HL01>4</HL01>
                <HL02>3</HL02>
                <HL03>23</HL03>
                <HL04>0</HL04>
              </HL>
              <TRN>
                <TRN01>1</TRN01>
                <TRN02>4306773</TRN02>               
                <TRN03>9000015430</TRN03>
              </TRN>
              <Loop LoopId="2100D" Name="Dependent Name">
                <NM1>
                  <NM101>03</NM101>
                  <NM102>1</NM102>
                  <NM103>TOMAS</NM103>
                  <NM104>JOSEPH</NM104>
                </NM1>
                <DMG>
                  <DMG01>D8</DMG01>
                  <DMG02>19560123</DMG02>
                </DMG>
                <Loop LoopId="2110D" Name="Dependent Eligibility or Benefit Inquiry">
                  <EQ>
                    <EQ01>12</EQ01>
                  </EQ>
                  <DTP>
                    <DTP01>472</DTP01>
                    <DTP02>D8</DTP02>
                    <DTP03>20120502</DTP03>
                  </DTP>
                </Loop>
              </Loop>
            </HierarchicalLoop>
          </HierarchicalLoop>
        </HierarchicalLoop>
      </HierarchicalLoop>
      <SE>
        <SE01>15</SE01>
        <SE02>51492</SE02>
      </SE>
    </Transaction>
    <GE>
     <GE01>1</GE01>
      <GE02>51492</GE02>
    </GE>
  </FunctionGroup>
  <IEA>
    <IEA01>1</IEA01>
    <IEA02>000051492</IEA02>
  </IEA>

Regards,
Dinesh Arora.