Add filtering

To discard irrelevant responsibility results, use filtering.

{
  "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" }
            },
            "Filter": { "Field": { "name": "userId", "operator": "NOT_NULL" } }
          },
          {
            "Id": { "name": "groupResponsibilityId" },
            "Group": {
              "Id": { "name": "groupId" },
              "GroupName": { "name": "groupName" }
            },
            "Role": {
              "Signifier": { "name": "groupRoleName" }
            },
            "Filter": { "Field": { "name": "groupId", "operator": "NOT_NULL" } }
          }
        ]
      }
    }
  }
}
---
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"
        Filter:
          Field:
            name: "userId"
            operator: "NOT_NULL"
      -
        Id:
          name: "groupResponsibilityId"
        Group:
          Id:
            name: "groupId"
          GroupName:
            name: "groupName"
        Role:
          Signifier:
            name: "groupRoleName"
        Filter:
          Field:
            name: "groupId"
            operator: "NOT_NULL"

Filter is a reserved key. The example above first includes a userId is not null" filtering clause to show responsibilities with a related user by (More on available filters later in this guide). Then, select the related responsibilities again, this time only keeping those with a related group.

{
  "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"
              }
            ]
          }
        ],
        "Responsibility4": [
          {
            "groupResponsibilityId": "5fc0cc5f-e30e-488c-94bc-acdea171219d",
            "Group5": [
              {
                "groupId": "4eb1f4a9-14a3-4539-8afc-733925161179",
                "groupName": "admin"
              }
            ],
            "Role6": [
              {
                "groupRoleName": "Admin"
              }
            ]
          }
        ]
      }
    ]
  }
}

In the result tree, Responsibility1 shows all related users and Responsibility4 only contains the groups.