Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That's an X12 file, an 850 Purchase Order. As <a href="https://stackoverflow.com/users/251208/eppye">eppye</a> suggests in the comments, you will need to find out exactly what standard the file you're getting follows. To get you started there's a version of the 850 <a href="http://www.aftermarketsuppliers.org/Doc-Vault/MTC.aspx" rel="nofollow noreferrer">here</a>. "Draft MEMA 4010 850" will help you understand the format. "GCommerce 4010 850V1.4.doc" is the Data Dictionary that tells you what's in each element. Please understand, though, that unless you're selling auto parts, that's probably not the exact specification of the file you're working with. The people sending you the file should provide this to you.</p> <p>I would create a user object for each segment and loop, and one to represent the purchase order itself. The purchase order UO needs variables that are the data type of the segments and loops. Don't include the segments that are inside the loops, put those in the UO for the loop. The UO for a segment will have variables that are standard datatypes like string, integer, date, etc. for the Data Elements in the segment. Refer to the Data Dictionary for the datatypes.</p> <p>Note that if a segment repeats, the variable that holds the segment is an array. The variables for the loops will be arrays.</p> <p>Your objects that handle segments will have a method, e.g. <code>of_importLine</code> that splits up the line at the asterisk and stores the values.</p> <p>Your objects that handle loops will have a method, e.g. <code>of_readLoop</code> that reads lines (segments) until it reads the last segment of the loop. For each segment, it will create the UO for that type of segment, assign it to the instance variable, or the next array slot if the segment can repeat, and call the new object's <code>of_importLine</code>.</p> <p>Your object that handles the purchase order is like one for a loop, except that when it sees the first segment of a loop, it creates the UO for that kind of loop, assigns it to the next array slot for the loop, and calls the new object's of_readLoop. Note that while your purchase order object is reading inside a loop it will create a new object to read and store each repeat of the loop.</p> <p>Your objects that read loops should log an error and stop if a required segment is missing or a segment that doesn't belong in the loop is found. The error should include the line number and contents. I can't give you a detailed description of how to validate the purchase order itself because many of the segments are optional in the specification, but they probably aren't optional in your application. For each segment and loop the object has a variable for, it needs the sequence where the item appears and minimum and maximum occurrences. Then the PO object can check the segments and loops as it goes along.</p> <p>This will get the data from the document into objects that represent the parts of the document so you can work with the data. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload