function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jolanda VerhoefJolanda Verhoef 

Using Boolean Field in SmartSQL Statement

How do I test if a boolean value is true in a smartsql statement in the smartstore?

I have an SObject Response with one field: Boolean__c. Whether or not I include it in the indexSpecs doesn't seem to matter.
The following queries all return an empty list:
SELECT {responses:_soup} FROM {responses} WHERE {responses:Boolean__c} = 'true'
SELECT {responses:_soup} FROM {responses} WHERE {responses:Boolean__c} = 'false'
SELECT {responses:_soup} FROM {responses} WHERE {responses:Boolean__c} = 'True'
SELECT {responses:_soup} FROM {responses} WHERE {responses:Boolean__c} = 'False'
SELECT {responses:_soup} FROM {responses} WHERE {responses:Boolean__c} = true
SELECT {responses:_soup} FROM {responses} WHERE {responses:Boolean__c} = false
SELECT {responses:_soup} FROM {responses} WHERE {responses:Boolean__c} = True
SELECT {responses:_soup} FROM {responses} WHERE {responses:Boolean__c} = False

The following query returns all records:
SELECT {responses:_soup} FROM {responses} WHERE {responses:Boolean__c} = '%'
Unfortunately you can only provide filters for fields that are indexed and boolean type is not supported for indexes. Try marking this indexed field as type "string" in your smartstore soup.