---
title: HierarchialTransaction
summary: API reference for HierarchialTransaction.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common.Files
reference_type: package
---

# HierarchialTransaction

`HierarchialTransaction` represents one BHT-rooted hierarchical transaction, keyed by the BHT segment's hierarchical structure code / reference identification element (BHT01) ([BR-034](../../business-rules.md#br-034-group-keys-derived-from-control-number-elements)). Instances are produced by `EdiGroupParser.CreateHierarchialTransactions` and each instance nests one or more `HierarchialLevel` objects representing the HL-rooted levels beneath it ([BR-035](../../business-rules.md#br-035-hierarchical-levels-nested-inside-hierarchical-transaction)).

## Purpose
- Provides typed access to the parsed BHT segment for this hierarchical transaction via `LevelData`, in addition to the raw `HierarchialTransactionSegment`.
- Owns `Levels`, the ordered collection of `IHierarchialLevel` instances nested inside this hierarchical transaction, each rooted at an HL segment ([BR-035](../../business-rules.md#br-035-hierarchical-levels-nested-inside-hierarchical-transaction)).
- Initializes both `Levels` and `Segments` to empty lists in its constructor so consumers never encounter a null collection before parsing populates them.

## Context
- Namespace: `SAIF.Common.Files.Edi`
- Assembly/package: `SAIF.Framework.Common.Files`
- Base class: `GroupContainer`
- Also derives (transitively) from `SegmentGroup` and `List<IEdiSegment>` (framework-standard collection base)
- Implements: `IHierarchialTransaction`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| LevelData | `public BhtSegment LevelData { get; internal set; }` | The strongly-typed BHT segment for this hierarchical transaction. |
| HierarchialTransactionSegment | `public IEdiSegment HierarchialTransactionSegment { get; internal set; }` | The raw BHT segment used as the source for `LevelData`. |
| Levels | `public IList<IHierarchialLevel> Levels { get; internal set; }` | The hierarchical levels (HL-rooted) nested within this hierarchical transaction, parsed by `EdiGroupParser.CreateHierarchialTransactions` ([BR-035](../../business-rules.md#br-035-hierarchical-levels-nested-inside-hierarchical-transaction)). |

## Inherited public members

Members in this section are inherited from `GroupContainer` in `SAIF.Framework.Common.Files`. They are available on this type through inheritance.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| HeaderSegment | `public IEdiSegment HeaderSegment { get; internal set; }` | The raw control segment that opens this group; not separately populated for hierarchical transactions since they are not delimited by a distinct trailer control segment.* | `SAIF.Framework.Common.Files` — `GroupContainer` |
| TrailerSegment | `public IEdiSegment TrailerSegment { get; internal set; }` | The raw control segment that closes this group; not separately populated for hierarchical transactions.* | `SAIF.Framework.Common.Files` — `GroupContainer` |
| Segments | `public IEnumerable<IEdiSegment> Segments { get; internal set; }` | This hierarchical transaction's member segments with the BHT/HL/ST/SE control segments excluded ([BR-033](../../business-rules.md#br-033-control-segments-excluded-from-member-segments-collections)). | `SAIF.Framework.Common.Files` — `GroupContainer` |

Members in this section are also inherited from `SegmentGroup` in `SAIF.Framework.Common.Files` (the next ancestor up the chain).

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| SegmentGroupId | `public string SegmentGroupId { get; set; }` | The segment tag (`"BHT"`) that this group was delimited by during parsing. | `SAIF.Framework.Common.Files` — `SegmentGroup` |
| Index | `public int Index { get; set; }` | The sequential ordinal assigned to this hierarchical transaction among its siblings. | `SAIF.Framework.Common.Files` — `SegmentGroup` |
| Key | `public string Key { get; set; }` | The BHT01 value that uniquely identifies this hierarchical transaction ([BR-034](../../business-rules.md#br-034-group-keys-derived-from-control-number-elements)). | `SAIF.Framework.Common.Files` — `SegmentGroup` |
| Level | `public int Level { get; set; }` | The nesting depth of this group, defaulted to `0`. | `SAIF.Framework.Common.Files` — `SegmentGroup` |

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

## Sources
- Common\SAIF.Common.Files\Edi\HierarchialTransaction.cs
- Common\SAIF.Common.Files\Edi\IHierarchialTransaction.cs
