Skip to content

Organization Attributes in SqueakQL

Organization Attributes in SqueakQL

SqueakQL supports bounded predicates for the Organization Attribute vocabulary available to the caller. A Project-restricted PAT sees only definitions enabled or retained in one of its granted Projects. Queries use immutable definition and option keys, not editable display names or labels. A rename therefore does not change the meaning of a saved query. Attributes cannot be used for ORDER BY, grouping, or report dimensions.

Scalar predicates

Write the definition key after the attribute_ prefix. Single-select values are option keys; booleans use the TRUE and FALSE literals:

attribute_customer = 'acme'
OR attribute_customer IN ('acme', 'contoso')
OR attribute_customer <> 'legacy'
OR attribute_verified = TRUE
OR attribute_verified = FALSE
OR attribute_customer IS NULL
OR attribute_verified IS NOT NULL

The scalar field form supports single-select and boolean definitions only. Boolean predicates support equality, inequality, and NULL checks. Single-select predicates support equality, inequality, IN, NOT IN, and NULL checks. Comparisons with labels, ordering, ranges, text matching, and scalar comparison of multi-select values are rejected rather than coerced.

Multi-select membership

Use the fixed membership functions with the definition key first and one or more option keys after it:

attribute_has_any('product_area', 'search', 'mobile')
OR attribute_has_all('product_area', 'search', 'mobile')
OR NOT attribute_has_any('product_area', 'legacy')

attribute_has_any matches when at least one listed option is assigned; attribute_has_all matches when every listed option is assigned. NOT uses SQL-style three-valued logic: an unset value does not match the negated predicate. Empty option lists, duplicate keys, and unknown options are errors.

Unset, opt-out, and retired values

Unset scalar values evaluate to SQL NULL. A Project without an enabled definition has no assignment for that definition and the predicate evaluates as unset. An explicit IS NULL matches it. A comparison, including its negation, does not match unset data; write ... OR attribute_key IS NULL when the unset case should be included. Boolean FALSE remains distinct from unset.

Assignments retained after Project opt-out, definition disablement, or option retirement remain queryable for users authorized to read that Work Item. The query result reveals no definition or option outside the caller’s authorized Organization. A Project-restricted PAT cannot discover definitions that are neither enabled nor retained in one of its granted Projects.

Validation and errors

The SqueakQL editor and validation endpoint check grammar, key shape, operator shape, and literal types without checking whether a definition exists. During search, Hamstik first applies the caller’s Organization, Project, PAT, and Work Item authorization, then resolves Attribute and option keys inside the authorized Organization vocabulary (or a Project-restricted PAT’s granted Project vocabulary). Missing, foreign, or otherwise unavailable references produce the same generic Attribute-reference diagnostic; they do not disclose hidden definitions or Projects. Type/operator mismatches and unsupported comparisons have documented validation diagnostics.

For the other supported Work Item fields, see the SqueakQL field reference and error reference.