15

Lets say I have records with values like 'TEST DATA' and 'test data' in some field. When I run SOQL (in Developer Console or from Apex) by user with EN locale, it arranges records with 'TEST DATA' and 'test data' values to one group, but when I run same query by user with non-English locale (or same user after switching locale to non-English), it separates records to different groups.

I tried several different non-English locales, like Spanish, German, Italian, and it works same.

The example of SOQL query is:

SELECT MyField__c MyField__c_2, GROUPING(MyField__c) grouping_MyField__c_2, SUM(Amount) SUM_Amount, count(Id) cnt 
FROM Opportunity 
GROUP BY ROLLUP(MyField__c) 
ORDER BY GROUPING(MyField__c) desc, MyField__c desc NULLS LAST

I think it should work same for any locales, and not sure why it's not. I know that in Salesforce SOQL sort order is determined by current user locale, but I observe same behavior for group by also, and don't know if this is correct behavior or not.

3

1 Answer 1

3

The Knowledge Article - In the SOQL, GROUP BY is not case sensitive when User Locale is set to 'English'. states:

Description
If the User Locale is set to 'English', the GROUP BY in the SOQL behaves as case insensitive but for other user locales, it behaves as case sensitive.

Resolution
This is working as designed behavior when using current database.

Via Anil on twitter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .