> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nextedy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Relationships and Cardinality

> Relationships and Cardinality — common questions about Nextedy POWERSHEET.

export const LastReviewed = ({date, state}) => {
  if (!date) return null;
  const formatted = new Date(`${date}T00:00:00Z`).toLocaleDateString("en-US", {
    year: "numeric",
    month: "long",
    day: "numeric",
    timeZone: "UTC"
  });
  const label = state === "reviewed" ? `Last reviewed and confirmed up to date on ${formatted}` : `Last updated on ${formatted}`;
  return <p className="mt-10 text-sm text-gray-400 dark:text-zinc-500 not-prose">
      {label}
    </p>;
};

<AccordionGroup>
  <Accordion title="What relationship cardinalities are supported?">
    Powersheet supports two relationship cardinality types in the data model, plus the implicit reverse of many-to-one:

    | Cardinality | Direction | Navigation Property | UI Behavior |
    | - | - | - | - |
    | `many-to-one` | `direct` | Scalar (e.g., `chapter`) | Single-value reference picker |
    | One-to-many | `back` (reverse of N:1) | Collection (e.g., `userNeeds`) | Child rows (new sheet level) |
    | `many-to-many` | `back` | Collection via association (e.g., `systemRequirements`) | Multi-item reference picker |

    Relationships are defined in the `relationships` array of the data model and map to Polarion link roles via the `linkRole` property. Each relationship specifies a `direct` and `back` navigation property name.
  </Accordion>

  <Accordion title="How do I configure a many-to-one relationship?">
    A many-to-one relationship links multiple entities to a single target. Use the `direct` navigation property name in your source expand and column binding:

    ```yaml theme={null}
    relationships:
      - from: UserNeed
        to: Chapter
        cardinality: many-to-one
        storage: linkedWorkItems
        linkRole: parent
        direct:
          name: chapter
        back:
          name: userNeeds
    ```

    In the source, expand using the direct name. In columns, bind with `chapter` for a reference picker or `chapter.title` for a read-only display of the referenced entity's title.
  </Accordion>

  <Accordion title="How do many-to-many relationships differ from many-to-one?">
    Many-to-many relationships use an **association entity** between the two types. This requires a two-level expand in the source configuration and dot-notation in column bindings:

    ```yaml theme={null}
    # Source: two-level expand
    sources:
      - id: user_needs
        query:
          from: UserNeed
        expand:
          - name: systemRequirements
            expand:
              - name: systemRequirement

    # Columns: dot-notation binding
    columns:
      systemRequirements.systemRequirement:
        title: System Requirement
        list:
          search:
            - objectId
            - title
      systemRequirements.systemRequirement.title:
        title: SysReq Title
        hasFocus: true
    ```

    The first level (`systemRequirements`) reaches the association entity; the second level (`systemRequirement`) reaches the actual target entity. See the [Data Model Guides](/powersheet/guides/data-model/index) for walkthrough examples.
  </Accordion>
</AccordionGroup>

<LastReviewed date="2026-07-02" />
