EDI Tools for .NET generates EDI files using EDI Writer and its derived writers for every supported EDI standard. For more information on how to use EDI Writer head on to the Generate EDI files article.
All EDI writers can be configured with additional settings which change the behavior of the EDI writer.
- WriterSettings Reference
- X12WriterSettings Reference
- EdifactWriterSettings Reference
- Hl7WriterSettings Reference
- NcpdpScriptWriterSettings Reference
Common EDI writer settings
- Encoding - this is the System.Encoding to use when writing to the output stream or file. UTF8 by default.
- PreserveWhitespace - this is to preserve white spaces in data elements initialized with blanks. False by default.
- Postfix - this is the postfix string to be applied at the end of each segment. Null by default.
- Separators - this is the set of separators to be used when generating the EDI document. It uses the default delimiter sets for X12 and EDIFACT when not explicitly set. The separators can be changed at run-time by using the overloads of Write(ISA isa) or Write(UNB unb).
- AutoTrailers - Whether to automatically apply trailers to groups and interchanges.
- Obfuscate - Whether to obfuscate the values of all data elements of alpha and alphanumeric types. The obfuscation symbol is 'X'. The example value of "Jon Doe" will be obfuscated to "XXXXXXX", e.g., every character, including blanks, is replaced with an 'X'. False by default.
Apply writer settings to EDI writer
-
X12WriterSettings settings = new X12WriterSettings();
settings.AutoTrailers = true;
settings.Encoding = Encoding.UTF8;
settings.Postfix = Environment.NewLine;
settings.PreserveWhitespace = true;
settings.Separators = Separators.X12;
using (var writer = new X12Writer(stream, settings)) -
EdifactWriterSettings settings = new EdifactWriterSettings();
settings.AutoTrailers = true;
settings.Encoding = Encoding.UTF8;
settings.Postfix = Environment.NewLine;
settings.PreserveWhitespace = true;
settings.Separators = Separators.Edifact;
using (var writer = new EdifactWriter(stream, settings)) -
Hl7WriterSettings settings = new Hl7WriterSettings();
settings.AutoTrailers = true;
settings.Encoding = Encoding.UTF8;
settings.Postfix = Environment.NewLine;
settings.PreserveWhitespace = true;
settings.Separators = Separators.Hl7;
using (var writer = new Hl7Writer(stream, settings)) -
NcpdpScriptWriterSettings settings = new NcpdpScriptWriterSettings();
settings.AutoTrailers = true;
settings.Encoding = Encoding.UTF8;
settings.Postfix = Environment.NewLine;
settings.PreserveWhitespace = true;
settings.Separators = Separators.NcpdpScript;
using (var writer = new NcpdpScriptWriter(stream, settings))
Comments
0 comments
Please sign in to leave a comment.