Skip to content

BhtSegment

BhtSegment models the X12 BHT beginning-of-hierarchical-transaction segment, the header that opens the business-transaction body of an 837/835/277 transaction set, carrying the transaction's purpose, reference identifier, date/time, and transaction type. Its IsOriginal flag records whether the transaction is an original submission or a reissue, mapped to the literal codes "00"/"08" (BR-044).

Purpose

  • Represents the BHT segment identity via SegmentId returning the literal "BHT" (BR-020).
  • Carries the hierarchical structure code, an original/reissue flag, a reference identifier, a transaction date/time, and a transaction type code that together open the business transaction body.
  • Encodes IsOriginal as "00" (original submission) or "08" (reissue) on Build(), and decodes it back to a boolean by comparing against "00" on Fill() (BR-044).

Context

  • Namespace: SAIF.Common.Files.Edi.Segments
  • Assembly/package: SAIF.Framework.Common.Files

Public members

Member Signature Purpose
SegmentId string SegmentId { get; } Returns the literal X12 segment identifier "BHT".
StructureCode string StructureCode { get; set; } The hierarchical structure code describing the transaction's structural purpose (BHT01), read/written at element 1.
IsOriginal bool IsOriginal { get; set; } True for an original submission (written/read as "00"), false for a reissue (written as "08") (BR-044).
ReferenceId string ReferenceId { get; set; } The submitter's reference identifier for the transaction (BHT03), read/written at element 3.
TransactionDate DateTime TransactionDate { get; set; } The transaction's creation date and time, split into date (yyyyMMdd) and time (HHmmss) across elements 4-5 on Build(), and combined via DateMaker on Fill().
TransactionType string TransactionType { get; set; } The transaction type code (BHT06), read/written at element 6.
Build IEdiSegment Build() Creates a SegmentBuilder("BHT"), adds StructureCode, the IsOriginal flag as "00"/"08", ReferenceId, TransactionDate split into date and time elements, and TransactionType, returning the built segment.
Fill void Fill(IEdiSegment segment) Reads elements 1-6 via GetChildValue, deriving IsOriginal from equality with "00" and combining elements 4-5 via DateMaker.MakeDateTime into TransactionDate.
Parse static BhtSegment Parse(IEdiSegment segment) Instantiates a new BhtSegment, calls Fill(segment) on it, and returns it.

Sources

  • Common\SAIF.Common.Files\Edi\Segments\BhtSegment.cs