ExecuteToJSON (NotesQueryResultsProcessor - LotusScript)

Processes the input collections in the manner specified by the Sort Columns, overriding field values with formulas specified via addFormula calls, and returns JSON output to a NotesJSONNavigator object.

Defined in

NotesQueryResultsProcessor

Syntax

Set jsonnavigatorobj = notesQueryResultsProcessor.ExecuteToJSON()

The JSON syntax produced by NotesQueryResultsProcessor execution conforms to JSON RFC 8259. All results are output under the “StreamedResults” top element key. For categorized results, all nested details are output under the “Documents” key. Special keys “@nid” for NoteID and “@DbPath” are output so results can be acted upon on a document basis.

Fields that are lists on documents (multiply-occurring) are output as JSON arrays of like type.

Note: It is acknowledged that @DbPath is unnecessarily verbose on every result entry. HCL is seeking feedback on design details such as this through the Beta forum.

Parameters

None.

Example 1

Thie following example shows the basic format of QueryResultsProcessor JSON output.

{
   "StreamResults":[
      {
         "@nid":"NT0000A572",
         "@DbPath":"dev\\ordwrkqrp.nsf",
         "sales_person": "Smedley Gonstrap",
         "date_origin":"2001-10-26T00:00:00.00Z"
      },
      {
         "@nid":"NT0000A542",
         "@DbPath":"dev\\ordwrkqrp.nsf",
         "sales_person": "Otto Matic",
         "date_origin": "2001-10-26T00:00:00.00Z"
      }
}

Example 2

The following example shows the partno field value lists appearing as JSON arrays.

{
   "StreamResults":[
      {
         "@nid":"NT0000A3A6",
         "@DbPath":"dev\\ordwork.nsf",
         "Sales_Person":"Bryan Frye",
         "Order_origin":"San Diego",
         "Partno":[
            389,
            27883
         ]
      },
      {
         "@nid":"NT0000A3F6",
         "@DbPath":"dev\\ordwork.nsf",
         "Sales_Person":"Bryan Frye",
         "Order_origin":"San Diego",
         "Partno":[
            389,
            27883
         ]
      }
}

Example 3

The following shows the same output with the sales_person field categorized.

{
   "StreamResults":[
      {
         "Sales_person":"Bart Cherry",
         "documents":[
            {
               "@nid":"NT00009F22",
               "@DbPath":"dev\\ordwrk4.nsf",
               "Order_no":157779,
               "partno":587992
            },
            {
               "@nid":"NT00009EA6",
               "@DbPath":"dev\\ordwrk4.nsf",
               "Order_no":157602,
               "partno":388388
            },
            {
               "@nid":"NT00009DD2",
               "@DbPath":"dev\\ordwrk4.nsf",
               "Order_no":157285,
               "partno":587992
            }
},
{
         "Sales_person":"Bryan Frye",
         "documents":[
            {
               "@nid":"NT0000A2EA",
               "@DbPath":"dev\\ordwrk4.nsf",
               "Order_no":159141,
               "partno":388388
            },
            {
               "@nid":"NT0000A19E",
               "@DbPath":"dev\\ordwrk4.nsf",
               "Order_no":158701,
               "partno":587992
            }
}
}

Example 4

The following example shows output from categorized and aggregate function columns like those described in AddColumn.
{
  "StreamResults": [
    {
      "Department": "Administration",
      "JobTitle": "Account manager/representative (sales or account management)",
      "@@avg(salary)": 84545.45454545455,
      "@@sum(salary)": 930000,
      "category": [
        {
          "OU": "Canada",
          "@@count()": 1,
          "@@avg(salary)": 82500,
          "@@sum(salary)": 82500,
          "@@avg(salwithraise)": 86625,
          "documents": [
            {
              "@nid": "NT00009A62",
              "@DbPath": "c:\\domino\\data\\dev\\fake50k4.nsf",
              "FullName": "Grayson Regan"
            }
          ]
        },
        {
          "OU": "China",
          "@@count()": 2,
          "@@avg(salary)": 87500,
          "@@sum(salary)": 175000,
          "@@avg(salwithraise)": 91875,
          "documents": [
            {
              "@nid": "NT0001DA2A",
              "@DbPath": "c:\\domino\\data\\dev\\fake50k4.nsf",
              "FullName": "Donald Head"
            },
            {
              "@nid": "NT000111D2",
              "@DbPath": "c:\\domino\\data\\dev\\fake50k2.nsf",
              "FullName": "Luca Humphries"
            }
          ]
        }
      ]
    }
  ]
}