Filter your vacation service by category or field

I am using the residual library control to provide a json data feed. Can I filter a category or field with a URL parameter?

I understand that I can use the search string "& search = something", but that may give me erroneous results. I tried to find a field equal to some value, but that doesn't work for me.

If I cannot do this with the rest of the control, is it possible with Domino Data Services?

+3


source to share


1 answer


You can filter by category or field by value in viewJsonService if you add ?keys=yourValue

to url.

The REST service returns the same documents as with view.getAllDocumentsByKey ("yourValue").

The default is fuzzy filtering, which means that only the beginning of a column value must match. If you want an exact match, add &keysexactmatch=true

to the URL that is equivalent to view.getAllDocumentsByKey ("yourValue", true).

Example:

Assuming we have a "Forms" view with the first column sorted "Form".

Using a REST service



<xe:restService
    id="restService1"
    pathInfo="DocsByForm">
    <xe:this.service>
        <xe:viewJsonService
            viewName="Forms"
            defaultColumns="true">
        </xe:viewJsonService>
    </xe:this.service>
</xe:restService>

      

and url

http://server/database.nsf/RestServices.xsp/DocsByForm?keys=Memo&keysexactmatch=true

      

we will get all documents with form = "Memo" as JSON

[
  {
      "@entryid":"7-D5029CB83351A9A6C1257D820031E927",
      "@unid":"D5029CB83351A9A6C1257D820031E927",
      "@noteid":"11DA",
      "@position":"7",
      "@siblings":14,
      "@form":"Memo",
      "Form":"Memo",
      ... other columns ...
  },
  ... other documents
]

      

We will get the same result if the first column is classified.

+3


source







All Articles