CRM Analytics Quick Sort: Limitations and Guidance

CRM Analytics offers a powerful quick sort feature, enabling users to sort data directly within table and chart widgets by clicking column headers. However, some query configurations can interfere with this functionality. This document outlines known limitations and provides best practices for effective use of the quick sort feature.

Where Quick Sort Isn't Supported

Quick sort is disabled in the following scenarios due to technical conflicts that may result in query failures.

  • SAQL Queries with union statements
  • SAQL Queries with foreach or order by containing bound interactions
    • Where selection bindings lead to changes in projected columns
    • Examples include {{cell(...)}} used in foreach or order clauses
  • Fully Bound SAQL Queries
    • If key operations, such as group, foreach, or order are entirely bound, the system cannot reliably interpret or sort them
    • Partially bound queries support quick sort
  • PIGQL Queries
    • Quick sort isn't supported due to the static nature of PIGQL
  • Direct Queries (Salesforce/Snowflake/Data 360/Google BigQuery)
    • Quick sort doesn't support server-side sorting for these query types

Compact Forms

  • Compact Form 1.0
    • When subtotal is enabled, it introduces implicit bindings that interfere with sorting
  • Compact Form 2.0
    • When columnTotal is enabled and group, columnTotal, or subtotal contain any form of a binding

Why These Limitations Exist

Previously, CRM Analytics included automatic quick sort detection. However, this feature prevented some valid use cases, especially utilizing advanced bindings. Examples include:

  • Dependence on fully bound queries
  • Previous attempts to enable partial support, such as disabling only when an order clause was bound, resulted in runtime errors, particularly when bindings dynamically altered projected columns

Quick Sort Best Practices

  • Use partially bound queries wherever possible if sorting is required
  • Test quick sort behavior when changes are made to selection bindings, particularly within foreach or order by statements
  • If you intend to use quick sort, don't fully bind entire SAQL operations such as group, foreach, or order
Example
Example

Works with Quick Sort:

q = group q by {{cell(Step.selection, 0, "groupField").toString()}};
q = foreach q generate q.'Industry' as 'Industry', count(q) as 'Count';

Fails with Quick Sort:

q = foreach q generate {{cell(Step.selection, 0, "projection").toString()}};