How To FAQs

How to find the EDI version in a sample EDI file?

X12 & HIPAA files

x12-version.png

The version is the last element in the GS segment or the ST segment. When present, the version in the ST segment takes precedence.

EDIFACT & EANCOM files

edifact-version.png

The version is the combination of the edition and the release component elements following the message type in the UNH segment.

How to support X12 VICS

My EDI files are in X12 VICS format, can I still use the existing EDI templates?

To be able to read VICS files, ensure that:

  • When you use type load factory match the version with StartsWith() rather than an exact match.

Wrong:

 if (gs.VersionAndRelease_8 == "004010" &&
      st.TransactionSetIdentifierCode_01 == "850")
return typeof(TS850).GetTypeInfo();

Correct:

if (gs.VersionAndRelease_8.StartsWith("004010") &&
      st.TransactionSetIdentifierCode_01 == "850")
return typeof(TS850).GetTypeInfo();

This ensures that EDI files with versions specified as:

vics1.png

Will still be picked up by the type factory.

If you have this in project EdiFabric.Sdk.X12.Templates.V004010:

vics2.png

Create this in a new project EdiFabric.Sdk.X12.Templates.V004010.VICS:

vics3.png

Do I have to validate the EDI transactions when using AckMan?

To generate EDI acknowledgments all EDI items need to be published to AckMan. This includes error contexts, control segments, and EDI transactions.

Internally, AckMan invokes IsValid() for every EDI transaction and populates its MessageErrorContext with errors if any.

You don't need to invoke IsValid() again for any of the EDI transactions that were either returned as Message by AckMan in the MessageHandler or were originally published to AckMan. The validation had already been done and the handler also provides the extra information of whether the transaction is part of a duplicate functional group or interchange.

How to create my custom UNH or ST?

To create a custom UNH do the following:

  1. Inherit your new UNH from UNH in EdiFabric.Core
  2. Customize your new UNH, e.g. add new properties, etc.
  3. In the EDI template(s) change the reference of the segment in position one to point to the new UNH.

To create a custom ST do the following:

  1. Inherit your new ST from ST in EdiFabric.Core
  2. Customize your new ST, e.g. add new properties, etc.
  3. In the EDI template(s) change the reference of the segment in position one to point to the new ST.

The parser always requires UNH and ST to either be referenced from the shared segments in EdiFabric.Core or to inherit from them.

UNT and SE are automatically generated when using the EdiWriter. You can, however, turn the auto-generation off by setting autoTrailer to False. This is useful for situations when you want to manually control the trailer generation or have custom UNT or SE, created similarly to the examples above.

Was this article helpful?
2 out of 2 found this helpful