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

Value Range (VR) -- HL7v2 composite data type.

Specifies a range of values for a field. Used as a query parameter.

2 components:
1. First Data Code Value (ST)
2. Last Data Code Value (ST)

# `t`

```elixir
@type t() :: %HL7v2.Type.VR{
  first_data_code_value: binary() | nil,
  last_data_code_value: binary() | nil
}
```

# `encode`

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

Encodes a VR to a list of component strings.

## Examples

    iex> HL7v2.Type.VR.encode(%HL7v2.Type.VR{first_data_code_value: "A", last_data_code_value: "Z"})
    ["A", "Z"]

    iex> HL7v2.Type.VR.encode(%HL7v2.Type.VR{first_data_code_value: "100"})
    ["100"]

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

# `parse`

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

Parses a VR from a list of components.

## Examples

    iex> HL7v2.Type.VR.parse(["A", "Z"])
    %HL7v2.Type.VR{first_data_code_value: "A", last_data_code_value: "Z"}

    iex> HL7v2.Type.VR.parse(["100"])
    %HL7v2.Type.VR{first_data_code_value: "100"}

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

---

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