Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Filter

Index

Variables

Types: Record<string, IFilterType> = ...

Functions

  • Creates a filter

    Parameters

    • column: string

      The name of a column that is available in the associated query.

    • value: any

      Value(s) to be filtered upon.

    • Optional type: IFilterType

      Filter type for the filter. Defaults to LABKEY.Filter.Types.EQUAL.

    Returns IFilter

    A filter instance.

    // Create a request with the data filtered
    LABKEY.Query.selectRows({
    schemaName: 'lists',
    queryName: 'People',
    filterArray: [
    LABKEY.Filter.create('FirstName', 'Johnny'),
    LABKEY.Filter.create('Age', 15, LABKEY.Filter.Types.LESS_THAN_OR_EQUAL)
    LABKEY.Filter.create('LastName', ['A', 'B'], LABKEY.Filter.Types.DOES_NOT_START_WITH),
    ]
    success: function (data) {
    console.log("Success! " + data.rowCount + " rows returned.");
    },
    failure: function (errorInfo, options, responseObj) {
    console.error("Failed to query 'lists.People'.", errorInfo);
    },
    });
  • getFilterDescription(url: string, dataRegionName: string, columnName: string): string
  • Convert from URL syntax filters to a human readable description (e.g. "Is Greater Than 10 AND Is Less Than 100").

    Parameters

    • url: string

      URL containing the filter parameters

    • dataRegionName: string

      Name of the data region the column is a part of

    • columnName: string

      Name of the column to filter

    Returns string

    Human readable version of the filter

    var url = 'mylab.org?qwp1.priority~gt=10&qwp1.priority~lte=75';

    var description = LABKEY.Filter.getFilterDescription(url, 'qwp1', 'priority');

    console.log(description); // "Is Greater Than 10 AND Is Less Than or Equal To 75"
  • getFilterTypeForURLSuffix(urlSuffix: string): IFilterType
  • getFiltersFromParameters(params: Record<string, any>, dataRegionName?: string): IFilter[]
  • getFiltersFromUrl(url: string, dataRegionName?: string): IFilter[]
  • Create an array of IFilter objects from the filter parameters on the URL.

    Parameters

    • url: string

      The URL to parse filters from.

    • Optional dataRegionName: string

      The data region name scope for the filters. Defaults to "query".

    Returns IFilter[]

  • getQueryParamsFromUrl(url: string, dataRegionName?: string): Record<string, any>
  • Retrieves parameters used by parameterized queries from the passed in URL for a given data region name

    Parameters

    • url: string

      The URL to parse the query parameters from.

    • Optional dataRegionName: string

      The data region name scope for this query. Defaults to "query".

    Returns Record<string, any>

  • getSortFromUrl(url: string, dataRegionName?: string): string
  • Retrieves the raw sort value from a URL's query parameters for a data region scoped sort.

    Parameters

    • url: string

      The URL to parse the sorts from.

    • Optional dataRegionName: string

      The data region name scope for this query. Defaults to "query".

    Returns string

  • Given an array of filter objects, return a new filterArray with old filters from a column removed and new filters for the column added. If new filters are null, simply remove all old filters from baseFilters that refer to this column.

    Parameters

    • baseFilters: IFilter[]

      Array of existing filters created by create

    • columnName: string

      Column name of filters to replace

    • columnFilters: IFilter[]

      Array of new filters created by create. Will replace any filters referring to columnName

    Returns IFilter[]

  • registerFilterType(displayText: string, displaySymbol?: string, urlSuffix?: string, dataValueRequired?: boolean, multiValueSeparator?: string, longDisplayText?: string, minOccurs?: number, maxOccurs?: number, tableWise?: boolean, labkeySqlOperator?: string): IFilterType
  • Creates a FilterType object and stores it in the global URL Map used by Filter.getFilterTypeForURLSuffix

    Parameters

    • displayText: string

      The text to display in a filter menu

    • Optional displaySymbol: string

      The symbol to display in a filter menu

    • Optional urlSuffix: string

      The suffix used when adding the filter to a URL

    • Optional dataValueRequired: boolean

      Boolean used to indicate if a data value is required for the filter type

    • Optional multiValueSeparator: string

      The separator to use if multiple values are allowed for the filter type

    • Optional longDisplayText: string

      The text to display in a filter help menu

    • Optional minOccurs: number

      The minimum number of times the filter can be applied

    • Optional maxOccurs: number

      The maximum number of times the filter can be applied

    • Optional tableWise: boolean

      true if the filter applies to all columns on the table

    • Optional labkeySqlOperator: string

      The simple operator to use for generating labkey sql

    Returns IFilterType

Generated using TypeDoc