Code Monkey home page Code Monkey logo

Comments (4)

irobayna avatar irobayna commented on May 22, 2024

@kputnam I have tried the last two days to recreate the guide and transaction set definition for message RA820 as out of the messages I have implemented the one that appears to not be behaving correctly (the parsing that is). If I follow the implementation details as per the guide I get non deterministic and edi-pp never returns even with -N so I have end up back where I started.

When originally implementing this message we were getting a lot of NonDeterministic errors and you suggested collapsing some loops. This worked in the sense edi-pp is able to parse the message correctly. But somehow when I traverse the tree I get odd results. My main concern is getting the N1 LI segments in order that are associated with N1 HH segment

from stupidedi.

kputnam avatar kputnam commented on May 22, 2024

Can you email me a sample document and tell me which branch you're working in? I have a vague understanding of the problem but not enough to troubleshoot.

from stupidedi.

kputnam avatar kputnam commented on May 22, 2024

PS: In your example you're looping over ST segments, but in the body of the loop you are discarding the "current" ST segment and re-finding the first ST after GS each time. Instead of gs.find(:ST) should you be referring to st instead?

from stupidedi.

kputnam avatar kputnam commented on May 22, 2024

This example seems unusual to me, so let me know if I've misunderstood. Here's my translation:

First, start at GS and then find ST, from here find LS*A. From LS*A, loop over each N1*HH occurrence, call it n1, and print out it's second element. Then from this n1 find the _next_ N1*HH called x, and from here find the next occurrence of RMT*IV.

Print the RMT segment's second and third element and start the loop over. When the loop starts again, it will find the N1*HH segment we previously called x, but it will be known as n1 in this iteration.

            gs.find(:ST).flatmap{|x| x.find(:LS,'A') }
            .tap do |ls|
              ls.iterate(:N1, 'HH') do |n1|
                puts "N1 HH #{n1.element(2).map(&:node).fetch(0)}"
                n1.find(:N1, 'HH').flatmap{|x| x.find(:RMT,'IV') }
                .tap do |rmt|
                 @seller_invoice_number  = "#{rmt.element(2).map(&:node).fetch(0)}"
                  @total_gross_amount     = "#{rmt.element(3).map(&:node).fetch(0)}"
                  puts "RMT IV [$#{@total_gross_amount}] #{@seller_invoice_number}"
                  puts "==========================="
             end

I suspect you have one too many traversals, and n1.find(:N1, 'HH').flatmap{|x| x.find(:RMT, 'IV' } should be instead n1.find(:RMT, 'IV'), but I might be mistaken.

from stupidedi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.