• Resolved littleweewebsites

    (@littleweewebsites)


    I have 3 pods with a hierarchical relationship structure.

    projects has a relationship to scope, scope has a relationship to lessons.

    From lessons, how do I access the project id, when lessons don’t have a project id, it is the scope that has a project id.

    so something like lesson.scope.project.id?

Viewing 1 replies (of 1 total)
  • Plugin Contributor Jim True

    (@jimtrue)

    Did you create bi-directional relationships? ie you have projects -> scope; did you create a bidirectional relationship from scope to projecst so you can connect to the ‘parent’ of your scope. Likewise within Scope to Lessons, you’d want one going back from lessons to scope.

    if you need the project id of the ‘parent’ scope, you can then traverse backwards.

    Relationships for reference:
    Projects > Scopes: related_scopes, multiple select
    Scopes > Projects: related_project, single select
    Scopes > Lessons: related_lessons, multiple select
    Lessons > Scopes: related_scope, single select

    From Lessons:
    related_scope.related_project.ID

    Traversal is always:
    relationship_field.field_on_other_side

Viewing 1 replies (of 1 total)

The topic ‘Hierarchical Relationships’ is closed to new replies.