Namespace LABKEY.Query.GetData
GetData static class to access javascript APIs related to our GetData API.
Defined in: GetData.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
LABKEY.Query.GetData.getRawData(config)
Used to get the raw data from a GetData request.
|
<static> |
LABKEY.Query.GetData.renderQueryWebPart(config)
Used to render a queryWebPart around a response from GetData.
|
Method Detail
<static>
{LABKEY.Ajax.request}
LABKEY.Query.GetData.getRawData(config)
Used to get the raw data from a GetData request. Roughly equivalent to LABKEY.Query.selectRows or
LABKEY.Query.executeSql, except it allows the user to pass the data through a series of transforms.
- Parameters:
- {Object} config
- Required. An object which contains the following configuration properties:
- {Object} config.source
- Required. An object which contains parameters related to the source of the request.
- {String} config.source.type
- Required. A string with value set to either "query" or "sql". Indicates if the value is "sql" then source.sql is required. If the value is "query" then source.queryName is required.
- {*} config.source.schemaName
- Required. The schemaName to use in the request. Can be a string, array of strings, or LABKEY.FieldKey.
- {String} config.source.queryName
- The queryName to use in the request. Required if source.type = "query".
- {String} config.source.sql
- The LabKey SQL to use in the request. Required if source.type = "sql".
- {String} config.source.containerPath
- The path to the target container to execute the GetData call in.
- {String} config.source.containerFilter
- Optional. The container filter to use in the request. See LABKEY.Query.containerFilter for valid container filter types.
- {Object[]} config.transforms
- An array of objects with the following properties:
-
pivot: {Object} Optional. An object with the following properties:
- columns: {Array} The columns to pivot. Is an array containing strings, arrays of strings, and/or LABKEY.FieldKey objects.
- by: The column to pivot by. Can be an array of strings, a string, or a LABKEY.FieldKey
- groupBy: {Object[]} An array of Objects. Each object can be a string, array of strings, or a LABKEY.FieldKey.
-
aggregates: {Object[]} Optional. An array of objects with the following properties:
- fieldKey: Required. The target column. Can be an array of strings, a string, or a LABKEY.FieldKey
- type: {String} Required. The type of aggregate.
- alias: {String} Required. The name to alias the aggregate as.
- metadata: {Object} An object containing the ColumnInfo metadata properties.
-
filters: {Object[]} Optional. An array containing objects created with
LABKEY.Filter.create, LABKEY.Query.Filter objects, or javascript objects with the following
properties:
- fieldKey: Required. Can be a string, array of strings, or a LABKEY.FieldKey
- type: Required. Can be a string or a type from LABKEY.Filter#Types
- value: Optional depending on filter type. The value to filter on.
-
pivot: {Object} Optional. An object with the following properties:
- {Array} config.columns
- Optional. An array containing LABKEY.FieldKey objects, strings, or arrays of strings. Used to specify which columns the user wants. The columns must match those returned from the last transform.
- {Integer} config.maxRows
- The maximum number of rows to return from the server (defaults to 100000). If you want to return all possible rows, set this config property to -1.
- {Integer} config.offset
- The index of the first row to return from the server (defaults to 0). Use this along with the maxRows config property to request pages of data.
- {Boolean} config.includeDetailsColumn
- Include the Details link column in the set of columns (defaults to false). If included, the column will have the name "~~Details~~". The underlying table/query must support details links or the column will be omitted in the response.
- {Object[]} config.sort
- Optional. Define how columns are sorted. An array of objects with the following properties:
- fieldKey: The field key of the column to sort. Can be a string, array of strings, or a LABKEY.FieldKey
- dir: {String} Optional. Can be 'ASC' or 'DESC', defaults to 'ASC'.
- {Function} config.success
- Required. A function to be executed when the GetData request completes successfully. The function will be passed a LABKEY.Query.Response object.
- {Function} config.failure
- Optional. If no failure function is provided the response is sent to the console via console.error. If a function is provided the JSON response is passed to it as the only parameter.
- Returns:
- {LABKEY.Ajax.request}
<static>
LABKEY.Query.GetData.renderQueryWebPart(config)
Used to render a queryWebPart around a response from GetData.
- Parameters:
- {Object} config
- The config object for renderQueryWebpart is nearly identical to LABKEY.Query.GetData.getRawData, except it has an additional parameter webPartConfig, which is a config object for LABKEY.QueryWebPart. Note that the Query returned from GetData is a read-only temporary query, so some features of QueryWebPart may be ignored (i.e. showInsertButton, deleteURL, etc.).