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

Modify HI segment of 837 I & P files

Mar 21, 2014 at 6:11 PM
Greetings,

I am trying to access HI segment of 837 file. Here is the code I have tried. Please help me accessing and modifying the HI segment for all claims. [single 837 with multiple claims]
        FileStream fStream = new FileStream(str837FileName,FileMode.Open,FileAccess.Read);
        X12Parser parser = new X12Parser();                 
        List<Interchange> interchanges = parser.ParseMultiple(fStream);


         foreach (Interchange interchange   in interchanges)
                    {
                        foreach (FunctionGroup group in interchange.FunctionGroups)
                        {
                            foreach (Transaction transaction in group.Transactions)
                            {
                               // var tloops = transaction.Loops;
                                string txnCtrlNo = transaction.ControlNumber;

                                foreach (HierarchicalLoop hloops in transaction.HLoops)
                                {
                                    string loopid = hloops.HierarchicalChildCode;
                                    //hloops.Loops
                                //  var hcloops = hierarchicalLoops.HLoops;
                                //  HierarchicalLoopSpecification hloopspec = hierarchicalLoops.Specification;
                                //  string loopSpec = hloopspec.LoopId;

                                    foreach(HierarchicalLoop hhloops in hloops.HLoops)
                                    {
                                        //MessageBox.Show(hloops.SegmentString);
                                        foreach(Loop loops in hhloops.Loops)
                                        {                                                   

                                            foreach (Segment segments in loops.Segments)
                                            {
                                                string segmentname = segments.SegmentString;
                                                var rr = segments.GetElement(2);

                                            }

                                            if (loopidno.Equals("2300"))
                                            {
                                            string loopidno1 = loops.SegmentString;

                                            }
                                            //string loopidno = loops.Specification.SegmentSpecifications;
                                        }

                                    }
                                }

                                //And so on....

                            }

                        }

                    }

        fStream.Close();
        fStream.Dispose();