Breadcrumbs Pattern

Certified Associate Developer

Hello!

I am trying to figure out the best way to manage the Breadcrumbs Pattern, but I can't seem to grasp the way it is intended to be used.

{
  a!localVariables(
    local!currentNodeId: 4,
    /* This variable would normally be retrieved with a rule like rule!getBreadcrumbsForIdentifier(identifier: local!currentNodeId). */
    local!nodes: a!forEach(
      items: enumerate(local!currentNodeId) + 1,
      expression: choose(
        fv!item,
        a!map(name: "Home", identifier: 1),
        a!map(name: "My Documents", identifier: 2),
        a!map(name: "Strategy", identifier: 3),
        a!map(name: "2018 Road Map", identifier: 4)
      )
    ),
    {
      a!richTextDisplayField(
        labelPosition: "COLLAPSED",
        value: {
          a!forEach(
            items: local!nodes,
            expression: if(
              fv!isLast,
              a!richTextItem(text: fv!item.name, style: "STRONG"),
              {
                a!richTextItem(
                  text: fv!item.name,
                  /* The saveInto in this link would run the query or rule necessary to navigate the user to *
                   * the node in the breadcrumbs that they just clicked on.                                  */
                  link: a!dynamicLink(
                    value: fv!item.identifier,
                    saveInto: local!currentNodeId
                  ),
                  linkStyle: "STANDALONE"
                ),
                a!richTextItem(text: "  /  ", color: "SECONDARY")
              }
            )
          )
        }
      )
    }
  )
}

I'm particularly confused by the way we are supposed to redirect the user to other screens and get the identifier. Does it mean that every page needs an identifier? How do I manage this data?

The only application of this pattern I saw uses a CDT called "Breadcrumbs" (without a table) and constants-pointers to objects we are redirecting to, but this way seems not to be as programmatic as it could be.

What would be the best way to solve this?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Really depends on your context.

    I usually provide breadcrumbs in the form of 

    Home / Record

    where Home redirects you to the home page and Record redirects you to the Record Summary view.

    I do this for Tasks. In the Record View, I either don't provide the Record Breadcrumb or I grey it out depending on the user's preference.

  • 0
    Certified Associate Developer
    in reply to Mathieu Drouin

    My pages have the following structure:

    .
    └── Home
    ├── Subject 1
    │ ├── Quiz
    │ ├── Documents
    │ └── Online Resources
    └── Subject n
    ├── Quiz
    ├── Documents
    └── Online Resources

    I want to be able to navigate this hierarchy freely and breadcrumbs seem to be the solution. I'm just wondering how to set identifiers for different screens and pass them around. I was thinking of setting the identifier to 1 in a local variable of the main interface, then increment by 1 on each descendant interface, but the comments in the pattern mention an expression rule, which makes me wonder what am I missing.

Reply
  • 0
    Certified Associate Developer
    in reply to Mathieu Drouin

    My pages have the following structure:

    .
    └── Home
    ├── Subject 1
    │ ├── Quiz
    │ ├── Documents
    │ └── Online Resources
    └── Subject n
    ├── Quiz
    ├── Documents
    └── Online Resources

    I want to be able to navigate this hierarchy freely and breadcrumbs seem to be the solution. I'm just wondering how to set identifiers for different screens and pass them around. I was thinking of setting the identifier to 1 in a local variable of the main interface, then increment by 1 on each descendant interface, but the comments in the pattern mention an expression rule, which makes me wonder what am I missing.

Children
No Data