Configure Scripts for Dataset Creation

To be able to serve as a basis for Dataset creation, a script must return data in a format that can be processed by the Script plugin.  

A script can serve as a basis for Dataset if it outputs:

QueryResponse Format

{   
  "header": [ 
   {"name": <Header 1 Name>, "type": <Header 1 Type>},
   {"name": <Header 2 Name>, "type": <Header 2 Type>},
   {"name": <Header 3 Name>, "type": <Header 3 Type>],
  ],
  "data": [
   [<Value 1 of Header 1>, <Value 1 of Header 2>, <Value 1 of  Header 3>],
   [<Value 2 of Header 1>, <Value 2 of Header 2>, <Value 2 of  Header 3>]
  ]
}

A QueryResponse JSON blob is an JavaScript object with two properties:

  • header: contains an array of header objects that have two properties:
    • name: header name
    • type: header data type
  • data: arrays of data values separated by comma

Example

{   
  "header": [  
   { "name": "Accessed time", "type": "DATE" },  
   { "name": "Parent Category", "type": "INTEGER" },
   { "name": "User name", "type": "TEXT" },
   { "name": "User ID", "type": "INTEGER" },
   { "name": "User type", "type": "TEXT" },
   { "name": "Element name", "type": "TEXT" }
  ],
  "data": [     
   ["2020-11-18 10:41:13", 149, "support", 923, "Administrator", "Total Monthly Acquisition Cost Per Customer"],
   ["2020-10-15 07:42:21", 2, "alice", 541, "Power User", "GoogleAnalytics Users Europe"],
   ["2020-10-13 09:37:17", 14, "bob", 891, "Regular User", "Sales Summary 2019"] 
  ]
}

For more details on using a Custom Script as a Data Source, see Establish Connectivity to Script Plugin.