Using CodeLists To Validate EDI Element Data

In this tutorial we’ll discuss how to use External Code Lists to validate element data. 

By default some EDI elements can only contain specific values.  For example element 1 of segment ISA can only contain the values 00 or 03.  These are referred to as accepted values for an element.   Accepted values of element can be viewed in  EDI Rules Creator Studio.

Accepted values can be added, removed or edited in the screen above.  

If we wanted to validate zip codes, states, countries, CPT codes, or ICD codes, for example, we could also add them using the same method.  The issue, however, is that these lists are much larger.  This is where code lists enter the picture.  They allow an element’s accepted values to be located in an external file.  They are now called External Code Lists.

 The first step is to create an external code list.  Let’s create a file called States.txt and add a few accepted values to it.  Only the code is required, the description is optional

Content of States.txt

NY, New York
NJ, New Jersey
CA, California
TX, Texas

The next step is to refer to the External Code List in our validation rules file in the CODELIST Section

Content of States.txt

CODELISTS
States=[States.txt*,]
POSCodes=[POSCodes.txt*,]
ZipCodes=[ZipCodes.txt*,]

The last step is to tell the EDI Rules Creator Studio which elements should use the External Code List as it accepted values.  In the EDI FILE STRUCTURE tab we can just navigate to the segment which contains the element where we want to apply the external code list to.  In this case we want to apply it to segment N4 element 2.

We can right-click on the segment, choose Edit Segment…, navigate to the second element (02) and select the States code list in the Code List column.  We can then hit the Update button to make element 2 use the States external code list to validate its data.

 Let’s check if our changes work by validating a sample file.  It does!

We can now see that if a state is not in our external code list an error will be generated.  We can use External Code Lists to validate any type of data.

 

Now that was easy!

 

Take Charge Of EDI

RDPCrystal EDI Library

trial2