Filter a View by a custom parameter


#1

Hi All! Could I use a custom parameter to filter a view? Not only with the Id?.

I have a list of “events” with a “members” attribute on each one.
Could I filter the list of events related to an specific user? …filtering the events based on the list of users defined in the members attribute?

Thanks,
Carlos


#2

@cfontana0 can you show us some exemplary row keys that get returned and how you would like to filter that?


#3

Sure! Please check the following example.

I want to filter by the following attributes: owner.id and users.

If I filter by the user “123” I have to see only the first Document.
If I filter by the user “456” I have to see both Documents.
If I filter by the user “000” I have to see the secound Document (it is filter by the owner.id)

{
  "_sync": {
    ...
  },
  "active": true,
  "createdAt": "2015-01-15T23:13:22.174Z",
  "description": "1",
  "id": "074DE14D-28AF-45A8-9573-E430810F3F3D",
  "modifiedAt": "2015-01-15T23:13:22.174Z",
  "name": "Thu Jan 15 2015 20:13:20 GMT-0300 (ART)",
  "owner": {
    "firstName": "Carlos",
    "id": "789",
    "lastName": "Fontana",
    "role": "user",
    "selected": false,
    "timezone": "PST"
  },
  "users" : ["123", "456"]
  "type": "event"
}

{
  "_sync": {
    ...
  },
  "active": true,
  "createdAt": "2015-01-15T23:13:22.174Z",
  "description": "2",
  "id": "174DE14D-28AF-45A8-9573-E430810F3F3D",
  "modifiedAt": "2015-01-15T23:13:22.174Z",
  "name": "Thu Jan 15 2015 20:13:20 GMT-0300 (ART)",
  "owner": {
    "firstName": "C",
    "id": "000",
    "lastName": "C",
    "role": "user",
    "selected": false,
    "timezone": "PST"
  },
  "users" : ["456", "789"]
  "type": "event"
}