# `Diffo.Provider.Calculations.FieldViaAssignedRelationship`
[🔗](https://github.com/diffo-dev/diffo/blob/v0.9.0/lib/diffo/provider/components/calculations/field_via_assigned_relationship.ex#L5)

Reads a field from the source instance of an `AssignmentRelationship`.

Traverses `AssignmentRelationship` in reverse — filtering by `target_id = current.id`
— to reach the source instances (pool owners) that assigned something to this instance,
then returns the named field from each.

## Options

- `field:` *(required)* — atom naming the field to read from the source instance
  (e.g. `:name`, `:type`).
- `via:` *(optional)* — list of alias atoms to step through. Each step filters
  `AssignmentRelationship` by the alias and follows `source_id` to the next set of
  instances. Multi-hop is supported by chaining steps. When omitted, all assignments
  where `target_id = current.id` are traversed without alias filtering.

## Examples

    # Name of the CVC that holds the :svlan assignment slot on this AVC
    calculate :cvc_id, {:array, :string},
      {Diffo.Provider.Calculations.FieldViaAssignedRelationship, [via: [:svlan], field: :name]}

    # Name of every instance that has ever assigned anything to this one
    calculate :assigner_names, {:array, :string},
      {Diffo.Provider.Calculations.FieldViaAssignedRelationship, [field: :name]}

# `describe`

# `has_calculate?`

# `has_expression?`

# `init`

# `strict_loads?`

---

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