QueryUtils Class

Contains helper methods to locally filter, sort, and apply limit and offset clauses to data rows. This helper class is provided for your convenience during early development and tests, but it isn’t supported for use in production environments.

Namespace

DataSource

Usage

The DataSource.QueryUtils class and its helper methods can process query results locally within your Salesforce org. This class is provided for your convenience to simplify the development of your Salesforce Connect custom adapter for initial tests. However, the DataSource.QueryUtils class and its methods aren’t supported for use in production environments that use callouts to retrieve data from external systems. Complete the filtering and sorting on the external system before sending the query results to Salesforce. When possible, use server-driven paging or another technique to have the external system determine the appropriate data subsets according to the limit and offset clauses in the query.

QueryUtils Methods

The following are methods for QueryUtils.

applyLimitAndOffset(queryContext, rows)

Returns a subset of data rows after locally applying limit and offset clauses from the query. This helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments.

Signature

public static List<Map<String,Object>> applyLimitAndOffset(DataSource.QueryContext queryContext, List<Map<String,Object>> rows)

Parameters

queryContext
Type: DataSource.QueryContext
Represents the query to run against a data table.
rows
Type: List<Map<String, Object>>
Rows of data.

Return Value

Type: List<Map<String, Object>>

filter(queryContext, rows)

Returns a subset of data rows after locally ordering and applying filters from the query. This helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments.

Signature

public static List<Map<String,bject>> filter(DataSource.QueryContext queryContext, List<Map<String,Object>> rows)

Parameters

queryContext
Type: DataSource.QueryContext
Represents the query to run against a data table.
rows
Type: List<Map<String, Object>>
Rows of data.

Return Value

Type: List<Map<String, Object>>

process(queryContext, rows)

Returns data rows after locally filtering, sorting, ordering, and applying limit and offset clauses from the query. This helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments.

Signature

public static List<Map<String,bject>> process(DataSource.QueryContext queryContext, List<Map<String,Object>> rows)

Parameters

queryContext
Type: DataSource.QueryContext
Represents the query to run against a data table.
rows
Type: List<Map<String, Object>>
Rows of data.

Return Value

Type: List<Map<String, Object>>

sort(queryContext, rows)

Returns data rows after locally sorting and applying the order from the query. This helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments.

Signature

public static List<Map<String,ject>> sort(DataSource.QueryContext queryContext, List<Map<String,bject>> rows)

Parameters

queryContext
Type: DataSource.QueryContext
Represents the query to run against a data table.
rows
Type: List<Map<String, Object>>
Rows of data.

Return Value

Type: List<Map<String, Object>>