# `HL7v2.Type.QSC`
[🔗](https://github.com/Balneario-de-Cofrentes/hl7v2/blob/v3.10.1/lib/hl7v2/type/qsc.ex#L1)

Query Selection Criteria (QSC) -- HL7v2 composite data type.

Used in QRD for specifying selection criteria in queries.

4 components:
1. Segment Field Name (ST) -- e.g., "@PID.3"
2. Relational Operator (ID) -- EQ, NE, GT, LT, GE, LE, CT, GN
3. Value (ST)
4. Relational Conjunction (ID) -- AND, OR

# `t`

```elixir
@type t() :: %HL7v2.Type.QSC{
  relational_conjunction: binary() | nil,
  relational_operator: binary() | nil,
  segment_field_name: binary() | nil,
  value: binary() | nil
}
```

# `encode`

```elixir
@spec encode(t() | nil) :: list()
```

Encodes a QSC to a list of component strings.

## Examples

    iex> HL7v2.Type.QSC.encode(%HL7v2.Type.QSC{segment_field_name: "@PID.3", relational_operator: "EQ", value: "12345"})
    ["@PID.3", "EQ", "12345"]

    iex> HL7v2.Type.QSC.encode(nil)
    []

# `parse`

```elixir
@spec parse(list()) :: t()
```

Parses a QSC from a list of components.

## Examples

    iex> HL7v2.Type.QSC.parse(["@PID.3", "EQ", "12345", "AND"])
    %HL7v2.Type.QSC{segment_field_name: "@PID.3", relational_operator: "EQ", value: "12345", relational_conjunction: "AND"}

    iex> HL7v2.Type.QSC.parse(["@PID.5.1", "CT", "Smith"])
    %HL7v2.Type.QSC{segment_field_name: "@PID.5.1", relational_operator: "CT", value: "Smith"}

    iex> HL7v2.Type.QSC.parse([])
    %HL7v2.Type.QSC{}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
