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

# QtySegment

`QtySegment` models the X12 QTY quantity segment, a generic carrier for a single qualified numeric quantity (e.g. units, visits) used across 837/835 transactions wherever a count value needs to be reported with a qualifying code.

## Purpose
- Represents the QTY segment identity via `SegmentId` returning the literal `"QTY"` ([BR-020](../../business-rules.md#br-020-first-element-is-the-segment-identifier)).
- Carries `QuantityQualifierCode` identifying what the quantity represents, paired with `Quantity` holding the numeric value.

## 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 `"QTY"`. |
| QuantityQualifierCode | `string QuantityQualifierCode { get; set; }` | The code qualifying what `Quantity` represents (QTY01), element 1. |
| Quantity | `decimal Quantity { get; set; }` | The qualified numeric quantity value (QTY02), element 2. |
| Build | `IEdiSegment Build()` | Creates a `SegmentBuilder("QTY")` and adds `QuantityQualifierCode` and `Quantity` at elements 1-2, returning the built segment. |
| Fill | `void Fill(IEdiSegment segment)` | Reads elements 1-2 via `GetChildValue`, converting element 2 to `decimal`, into `QuantityQualifierCode` and `Quantity`. |
| Parse | `static QtySegment Parse(IEdiSegment segment)` | Instantiates a new `QtySegment`, calls `Fill(segment)` on it, and returns it. |

## Sources
- Common\SAIF.Common.Files\Edi\Segments\QtySegment.cs
