Add a related entity more than once

To understand what roles users have in communities, you must query the groups that are linked through a responsibility.

To add another relation from community to responsibility, select the related groups.

This example shows the Id property of the two-responsibility nodes selected.

{
  "ViewConfig": {
    "Resources": {
      "Community": {
        "Id": { "name": "communityId" },
        "Name": { "name": "communityName" },
        "Responsibility": [
          {
            "Id": { "name": "userResponsibilityId" },
            "User": {
              "Id": { "name": "userId" },
              "FirstName": { "name": "firstName" },
              "LastName": { "name": "lastName" }
            },
            "Role": {
              "Signifier": { "name": "userRoleName" }
            }
          },
          {
            "Id": { "name": "groupResponsibilityId" },
            "Group": {
              "Id": { "name": "groupId" },
              "GroupName": { "name": "groupName" }
            },
            "Role": {
              "Signifier": { "name": "groupRoleName" }
            }
          }
        ]
      }
    }
  }
}
---
ViewConfig:
  Resources:
    Community:
      Id:
        name: "communityId"
      Name:
        name: "communityName"
      Responsibility:
      - Id:
          name: "userResponsibilityId"
        User:
          Id:
            name: "userId"
          FirstName:
            name: "firstName"
          LastName:
            name: "lastName"
        Role:
          Signifier:
            name: "userRoleName"
      - Id:
          name: "groupResponsibilityId"
        Group:
          Id:
            name: "groupId"
          GroupName:
            name: "groupName"
        Role:
          Signifier:
            name: "groupRoleName"

To add the same related entity twice under the same node, change the JSON object into an array. In this case, the Responsibility JSON object became an array, and the anonymous JSON objects composing the array are multiple responsibilities.

If you add the admin group to the second community, the results would be formatted similar to the example below.

{
  "view": {
    "Community0": [
      {
        "communityId": "c87f166e-041f-4bea-8ff7-c1ffbab2ceeb",
        "communityName": "First Community"
      },
      {
        "communityId": "12345678-0020-0000-0000-000000000000",
        "communityName": "Second Community",
        "Responsibility1": [
          {
            "userResponsibilityId": "0ecb2fff-d5de-43d0-be60-f7f201c10d41",
            "User2": [
              {
                "userId": "00000000-0000-0000-0000-000000900002",
                "firstName": "Admin",
                "lastName": "Istrator"
              }
            ],
            "Role3": [
              {
                "roleName": "Admin"
              }
            ]
          },
          {
            "userResponsibilityId": "42b9d114-2c0c-4e96-a1ce-b645d5e92365",
            "User2": [
              {
                "userId": "00000000-0000-0000-0000-000000900002",
                "firstName": "Admin",
                "lastName": "Istrator"
              }
            ],
            "Role3": [
              {
                "roleName": "Steward"
              }
            ]
          },
          {
            "groupResponsibilityId": "5fc0cc5f-e30e-488c-94bc-acdea171219d",
            "User2": [
              {}
            ],
            "Role3": [
              {
                "roleName": "Admin"
              }
            ]
          }
        ],
        "Responsibility4": [
          {
            "userResponsibilityId": "0ecb2fff-d5de-43d0-be60-f7f201c10d41",
            "Group5": [
              {}
            ],
            "Role6": [
              {
                "groupRoleName": "Admin"
              }
            ]
          },
          {
            "userResponsibilityId": "42b9d114-2c0c-4e96-a1ce-b645d5e92365",
            "Group5": [
              {}
            ],
            "Role6": [
              {
                "groupRoleName": "Steward"
              }
            ]
          },
          {
            "groupResponsibilityId": "5fc0cc5f-e30e-488c-94bc-acdea171219d",
            "Group5": [
              {
                "groupId": "4eb1f4a9-14a3-4539-8afc-733925161179",
                "groupName": "admin"
              }
            ],
            "Role6": [
              {
                "groupRoleName": "Admin"
              }
            ]
          }
        ]
      }
    ]
  }
}

In the example above, the userResponsibilityId and groupResponsibilityId values contain three unique values in total: two related to a user and one to a group. When no further filtering is requested, adding the same entity twice means selecting the same thing twice. The result is one empty user for the responsibility linked to the group and two empty groups for each responsibility linked to a user.