Interface ExecuteSqlOptions

interface ExecuteSqlOptions {
    containerFilter?: ContainerFilter;
    containerPath?: string;
    failure?: RequestFailure<any>;
    includeMetadata?: boolean;
    includeStyle?: boolean;
    includeTotalCount?: boolean;
    maxRows?: number;
    offset?: number;
    parameters?: any;
    requiredVersion?: string | number;
    saveInSession?: boolean;
    schemaName: string;
    scope?: any;
    sort?: string;
    sql: string;
    stripHiddenColumns?: boolean;
    success?: RequestSuccess<any>;
    timeout?: number;
}

Hierarchy (view full)

Properties

containerFilter?: ContainerFilter

One of the values of ContainerFilter that sets the scope of this query. Defaults to ContainerFilter.current, and is interpreted relative to config.containerPath.

containerPath?: string

The path to the container in which the schema and query are defined, if different than the current container. If not supplied, the current container's path will be used.

failure?: RequestFailure<any>

This will be called upon failure to complete a request.

includeMetadata?: boolean

Include metadata for the selected columns. Defaults to true.

includeStyle?: boolean
includeTotalCount?: boolean

Include the total number of rows available (defaults to true). If false totalCount will equal number of rows returned (equal to maxRows unless maxRows == 0).

maxRows?: number

The maximum number of rows to return from the server (defaults to returning 100,000 rows).

offset?: number

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.

parameters?: any

Map of name (string)/value pairs for the values of parameters if the SQL references underlying queries that are parameterized. For example, the following passes two parameters to the query: {'Gender': 'M', 'CD4': '400'}. The parameters are written to the request URL as follows: query.param.Gender=M&query.param.CD4=400. For details on parameterized SQL queries, see Parameterized SQL Queries.

requiredVersion?: string | number

If not set, or set to "8.3", the success handler will be passed a SelectRowsResults object. If set to "9.1" the success handler will be passed an ExtendedSelectRowsResults object. If greater than 13.2 the success handler will be passed a Response object. The main difference between SelectRowsResults and ExtendedSelectRowsResults is that each column in each row will be another object (not just a scalar value) with a "value" property as well as other related properties (url, mvValue, mvIndicator, etc.). In the Response format each row will be an instance of Row.

In the "16.2" format, multi-value columns will be returned as an array of values, each of which may have a value, displayValue, and url. In the "17.1" format, "formattedValue" may be included in the response as the display column's value formatted with the display column's format or folder format settings.

saveInSession?: boolean

Whether or not the definition of this query should be stored for reuse during the current session. If true, all information required to recreate the query will be stored on the server and a unique query name will be passed to the success callback. This temporary query name can be used by all other API methods, including Query Web Part creation, for as long as the current user's session remains active.

schemaName: string

Name of the schema to query.

scope?: any

A scoping object for the success and failure callback functions (default to this).

sort?: string

A sort specification to apply over the rows returned by the SQL. In general, you should either include an ORDER BY clause in your SQL, or specific a sort specification in this config property, but not both. The value of this property should be a comma-delimited list of column names you want to sort by. Use a - prefix to sort a column in descending order (e.g., 'LastName,-Age' to sort first by LastName, then by Age descending).

sql: string

The LabKey SQL to execute.

stripHiddenColumns?: boolean

If true, removes columns marked as "hidden" in response as well as data associated with that column. This is done in client-side post-processing.

success?: RequestSuccess<any>

This will be called upon successfully completing a request.

timeout?: number

The maximum number of milliseconds to allow for this operation before generating a timeout error (defaults to 30000).