Self-referencing (hierarchical) fields not available in Template Print

Hi team,

We’re currently using NocoBase to build an evaluation system with hierarchical data, and we’ve run into a limitation with the Template Print feature.


:jigsaw: Our Data Model

We have a self-referencing structure in the tests collection:

  • A test can have sub-tests using a self-referencing field:

    • tests.parent_test_id → tests.id

Example:

  • Shooting (parent test)

    • Accuracy (sub-test)
    • Speed (sub-test)

:page_facing_up: Use Case (Template Print)

We are trying to generate printable reports (using Template Print) that show:

  • Parent test (e.g., Shooting)
  • Its sub-tests (Accuracy, Speed)
  • Scores for each

Expected output structure:

Shooting: 21 / 30
  - Accuracy: 12 / 15
  - Speed: 9 / 15

Fitness: 18 / 20

:x: Problem

In Template Print:

  • Self-referencing relations (like sub_tests or parent_test) are not visible in the field selector
  • Only direct fields and simple relations are shown
  • There is no way to traverse or loop through hierarchical child records

This prevents us from:

  • Rendering sub-tests under a parent test
  • Building nested layouts in the print template
  • Accessing child records dynamically

:mag: Observations

  • Regular relations (e.g., belongsTo, hasMany) work fine when they are between different collections
  • However, self-referencing relations are not exposed in Template Print UI
  • Even when the relation exists and is populated in data, it is not selectable

:dart: Expected Behavior

We expect Template Print to support:

  1. Self-referencing relations in field list

    • Example: tests.sub_tests
  2. Nested rendering / iteration

    • Ability to loop through child records inside a parent block
  3. Multi-level traversal

    • Parent → child → grandchild (if needed)

:boom: Impact

This limitation affects:

  • Printable evaluation reports
  • Score breakdown visibility
  • Any hierarchical reporting use case

:pray: Request

Can you please confirm:

  • Whether this is a known limitation?
  • If there is a workaround?
  • If support for self-referencing relations in Template Print is planned?

Happy to share sample schema or data if needed.

Nocobase Version - 2.0.17

Thanks!

@hongboji - Any insights into this issue?

Thank you for reporting the issue. Please wait while we fix it.

1 Like