You can not use text area fields in SOQL and SOSL filter criterias.
Alternative is to fetch all records and then iterate (using for loop) to check your filter criteria.
Something like You have a field textarea__c on Account of type textarea and you want to fetch only accounts having value as "developer test" in field textarea__c.
The query SELECT Id, Name FROM Account where textarea__c like '%developer test%' will not work and you can not use this field in where clause.
Alternative way
List<Account> filteredaccounts = new List<Account>();
for(Account act : [select id, name, textarea__c from Account) {
if(act.textarea__c.contains('developer test')) {
filteredaccounts.add(act);
}
}
We have some other String methods like.. startswith, indexof which can be used to filter.
You can not use text area fields in SOQL and SOSL filter criterias.
Alternative is to fetch all records and then iterate (using for loop) to check your filter criteria.
Something like You have a field textarea__c on Account of type textarea and you want to fetch only accounts having value as "developer test" in field textarea__c.
The query SELECT Id, Name FROM Account where textarea__c like '%developer test%' will not work and you can not use this field in where clause.
Alternative way
List<Account> filteredaccounts = new List<Account>();
for(Account act : [select id, name, textarea__c from Account) {
if(act.textarea__c.contains('developer test')) {
filteredaccounts.add(act);
}
}
We have some other String methods like.. startswith, indexof which can be used to filter.
Is there even a way to see if textarea fields are null or not null?
Here's what striking out looks like.
force query "select casenumber, id from case where feature_data__c != null" casenumber, id from case where feature_data__c != null ^ ERROR at Row:1:Column:39 field 'feature_data__c' can not be filtered in query call
If your functionality can not live without this feature then there is a workaround that you can create a checkbox and update it using workflow field update on change of feature_Data__c change. So in workflow just check below:
You can not use text area fields in SOQL and SOSL filter criterias.
Alternative is to fetch all records and then iterate (using for loop) to check your filter criteria.
Something like You have a field textarea__c on Account of type textarea and you want to fetch only accounts having value as "developer test" in field textarea__c.
The query SELECT Id, Name FROM Account where textarea__c like '%developer test%' will not work and you can not use this field in where clause.
Alternative way
List<Account> filteredaccounts = new List<Account>();
for(Account act : [select id, name, textarea__c from Account) {
if(act.textarea__c.contains('developer test')) {
filteredaccounts.add(act);
}
}
We have some other String methods like.. startswith, indexof which can be used to filter.
Let me know if this helps.
Regards,
All Answers
You can not use text area fields in SOQL and SOSL filter criterias.
Alternative is to fetch all records and then iterate (using for loop) to check your filter criteria.
Something like You have a field textarea__c on Account of type textarea and you want to fetch only accounts having value as "developer test" in field textarea__c.
The query SELECT Id, Name FROM Account where textarea__c like '%developer test%' will not work and you can not use this field in where clause.
Alternative way
List<Account> filteredaccounts = new List<Account>();
for(Account act : [select id, name, textarea__c from Account) {
if(act.textarea__c.contains('developer test')) {
filteredaccounts.add(act);
}
}
We have some other String methods like.. startswith, indexof which can be used to filter.
Let me know if this helps.
Regards,
Thanks crmtech21,
But I have millions of records, can not proceed in this way.
Here's what striking out looks like.
force query "select casenumber, id from case where feature_data__c != null"
casenumber, id from case where feature_data__c != null
^
ERROR at Row:1:Column:39
field 'feature_data__c' can not be filtered in query call
If your functionality can not live without this feature then there is a workaround that you can create a checkbox and update it using workflow field update on change of feature_Data__c change. So in workflow just check below:
criteria :
IsChanged(feature_Data__c) && len(feature_Data__c) >0
Workflow action : field update :
Checkbox = true
Now you can use this checkbox in your query.
Happy coding and designing systems..
where TextArea_Search__c like '%missing%'