UniversityAPI ReferenceVIA Clause - Relationship Path Traversal

VIA Clause - Relationship Path Traversal

API Reference
3 min read
Updated December 12, 2025

VIA Clause - Relationship Path Traversal

The VIA clause in AXEL allows you to explicitly specify the relationship path when traversing between forms. This is essential when your relation field names don't match the target table name, or when you need to traverse multiple relationship hops.

Syntax

RELATED(Table[Column], VIA(field_name))
RELATED(Table[Column], VIA(field1, field2, field3, ...))
RELATEDTABLE(Table, VIA(field_name))

Why Use VIA?

In Mars, when you create a relation field, the field name might differ from the target form name. For example:

  • A field named assigned_customer links to the Customers form
  • A field named primary_location links to the Locations form

The VIA clause tells AXEL exactly which relation field to use for traversal.

Single-Hop Traversal

Basic Syntax

RELATED(TargetTable[column], VIA(relation_field))

Example: Get Customer Name for Orders

Data Model:

Orders (has field "customer" linking to Customers)
  └── Customers (has field "name")

Query:

RELATED([Customers][name], VIA(customer))

What It Does:

  1. For each order record, AXEL looks at the customer relation field
  2. Follows that relation to find the linked Customer record
  3. Returns the name column from that Customer

Example: Add Customer Info to Orders Table

ADDCOLUMNS(
  [Orders],
  "Customer Name", RELATED([Customers][name], VIA(customer)),
  "Customer Email", RELATED([Customers][email], VIA(customer))
)

Result:

Order ID Amount Customer Name Customer Email
ORD001 150.00 John Smith john@email.com
ORD002 89.99 Jane Doe jane@email.com

Multi-Hop Traversal

When you need to traverse multiple relationships in sequence, provide multiple field names separated by commas.

Basic Syntax

RELATED(Table[Column], VIA(field1, field2, field3))

How Multi-Hop Works

Each field in the VIA path is traversed sequentially:

Current Record
    └── VIA(field1) ──> Intermediate Table 1
                            └── VIA(field2) ──> Target Table

Example: Get Region from Orders (2 Hops)

Data Model:

Orders (has field "customer")
  └── Customers (has field "region")
        └── Regions (has field "name")

Query:

RELATED([Regions][name], VIA(customer, region))

Example: Get Department from Orders (3 Hops)

ADDCOLUMNS(
  [Orders],
  "Department", RELATED([Departments][name], VIA(product, category, department))
)

Field Name Matching

AXEL performs intelligent field name matching:

  1. Exact match: VIA(customer) → looks for customer
  2. Case-insensitive: VIA(Customer) → matches customer
  3. With 's' suffix: VIA(customer) → matches customers

Using VIA with RELATEDTABLE

ADDCOLUMNS(
  [Customers],
  "Order Count", COUNTX(RELATEDTABLE([Orders], VIA(customer)), 1),
  "Revenue", SUMX(RELATEDTABLE([Orders], VIA(customer)), [amount])
)

Orphan Records

When a relationship path is broken, the result is NULL by default. See JOIN and DEFAULT Options for handling orphans.

Next Steps