This project has moved and is read-only. For the latest updates, please go here.

Getting Error while building file

Feb 9, 2015 at 9:10 AM
Edited Feb 9, 2015 at 9:11 AM
Hi there,
I am trying to build 835 using Interchange object using OopFactory.

I written below lines of code.
 var message = new Interchange(Convert.ToDateTime("01/01/03"), 000905, false)
                InterchangeSenderIdQualifier = "ZZ",
                InterchangeSenderId = "SUBMITTERS.ID",
                InterchangeReceiverIdQualifier = "ZZ",
                InterchangeReceiverId = "RECEIVERS.ID",
                SecurityInfo = "SECRET",
                SecurityInfoQualifier = "01",
            message.SetElement(12, "00501");
            message.SetElement(10, "1253");
            message.SetElement(11, "^");

            var group = message.AddFunctionGroup("HC", DateTime.Now, 1, "005010X222");
            group.ApplicationSendersCode = "SENDER CODE";
            group.ApplicationReceiversCode = "RECEIVER CODE";
            group.Date = Convert.ToDateTime("12/31/1999");
            group.ControlNumber = 1;
            group.SetElement(5, "0802");

            var transaction = group.AddTransaction("835", "0001");
            transaction.SetElement(2, "0001");

            var payeeIdentificationLoop = transaction.AddLoop(new TypedLoopN1());
            payeeIdentificationLoop.N101_EntityIdentifierCode = "PE";
            payeeIdentificationLoop.N102_Name = "REGIONAL HOPE HSPITA";
            payeeIdentificationLoop.N103_IdentificationCodeQualifier = "XX";
            payeeIdentificationLoop.N104_IdentificationCode = "64356540";
But on the line transaction.AddLoop(new TypedLoopN1()) I am getting error saying Loop N1* could not be added because it could not be found in the specification for ST.

I found specification for 835 5010 files as below from OopFactory project.
<?xml version="1.0" encoding="utf-8" ?>
<TransactionSpecification xmlns="" TransactionSetIdentifierCode="835">
  <Segment SegmentId="BPR" Usage="Required" Repeat="1"/>
  <Segment SegmentId="TRN" Usage="Required" Repeat="1"/>
  <Segment SegmentId="CUR" Usage="Situational" Repeat="1"/>
  <Segment SegmentId="REF" Usage="Situational" Repeat="1"/>
  <Segment SegmentId="DTM" Usage="Situational" Repeat="1"/>
  <Segment SegmentId="PLB" Trailer="true" Usage="Situational" Repeat="1"/>
  <Loop LoopId="1000A" Usage="Required" LoopRepeat="1">
    <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
      <EntityIdentifier Code="PR"/>
    <Segment SegmentId="N3" Usage="Required" Repeat="1"/>
    <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
    <Segment SegmentId="REF" Usage="Situational" Repeat="4"/>
    <Segment SegmentId="PER" Usage="Situational" Repeat="1"/>
  <Loop LoopId="1000B" Usage="Required" LoopRepeat="1">
    <StartingSegment SegmentId="N1" Usage="Required" Repeat="1">
      <EntityIdentifier Code="PE"/>
    <Segment SegmentId="N3" Usage="Required" Repeat="1"/>
    <Segment SegmentId="N4" Usage="Required" Repeat="1"/>
    <Segment SegmentId="REF" Usage="Situational" Repeat="4"/>
    <Segment SegmentId="RDM" Usage="Situational" Repeat="1"/>
  <Loop LoopId="2000" Usage="Required" Repeat="9999">
    <Name>HEADER NUMBER</Name>
    <StartingSegment SegmentId="LX" Usage="Situational" Repeat="1"/>
    <Segment SegmentId="TS3" Usage="Situational" Repeat="1"/>
    <Segment SegmentId="TS2" Usage="Situational" Repeat="1"/>
    <Loop LoopId="2100">
      <StartingSegment SegmentId="CLP" Usage="Required" Repeat="9999"/>
      <Segment SegmentId="CAS" Usage="Situational" Repeat="99"/>
      <Segment SegmentId="NM1" Usage="Required" Repeat="1"/>
      <Segment SegmentId="MIA" Usage="Situational" Repeat="1"/>
      <Segment SegmentId="MOA" Usage="Situational" Repeat="1"/>
      <Segment SegmentId="REF" Usage="Situational" Repeat="5"/>
      <Segment SegmentId="DTM" Usage="Situational" Repeat="4"/>
      <Segment SegmentId="PER" Usage="Situational" Repeat="2"/>
      <Segment SegmentId="AMT" Usage="Situational" Repeat="13"/>
      <Segment SegmentId="QTY" Usage="Situational" Repeat="14"/>
      <Loop LoopId="2110">
        <StartingSegment SegmentId="SVC" Usage="Situational" Repeat="999"/>
        <Segment SegmentId="DTM" Usage="Situational" Repeat="2"/>
        <Segment SegmentId="CAS" Usage="Situational" Repeat="99"/>
        <Segment SegmentId="REF" Usage="Situational" Repeat="8"/>
        <Segment SegmentId="REF" Usage="Situational" Repeat="10"/>
        <Segment SegmentId="AMT" Usage="Situational" Repeat="9"/>
        <Segment SegmentId="QTY" Usage="Situational" Repeat="6"/>
        <Segment SegmentId="LQ" Usage="Situational" Repeat="99"/>
I was trying to find out what is the problem and below one is my analysis. (I compared N1 of 835 to NM1 of 837 file)

As per my understanding NM1 loop can be multiple in 837 file - 1000A SUBMITTER NAME, 1000B RECEIVER NAME. Same way 835 file N1 loop can be multiple - 1000A PAYER IDENTIFICATION, 1000B PAYEE IDENTIFICATION.

If we want to create NM1 loop for 837 file than we are passing entityIdentifier in constructor like below code.
transaction.AddLoop(new TypedLoopNM1("41")); //here 41 is entityIdentifier 
But there is no option to pass entityIdentifier in constructor of TypedLoopN1 object. we can create object of N1 like below mentioned code.
transaction.AddLoop(new TypedLoopN1()); 
I debugged code and I found in Oopfactory below condition is not satisfying. (Inside LoopContainer Class -> GetLoopSpecification method)
matchingLoopSpecs.Where(ls => ls.StartingSegment.SegmentId == segment.SegmentId).Count() ==1
As per specification of 835, N1 can be two type. So here we are getting count as 2. So condition is not satisfying and its returning null and we are getting exception.

Let me know if anything I am missing from my end.
Jul 29, 2016 at 12:06 AM
Did you ever get a response? I am having the same issue with a 5010 834.