3

I'm having an issue querying the Salesforce API with a number larger than the max for a 32-bit integer.

I don't think it's code-based as the problem is also encountered when using the Salesforce developer console.

I'm trying to query WHERE custom_field = xxx. custom_field set to Number(18,0) and is able to store the value I'm trying to SELECT against.

If I test SELECT x FROM y WHERE custom_field = 2147483647 in the developer console, it executes without any issues. Any numbers 'smaller' than this value work fine.

If I test SELECT x FROM y WHERE custom_field = 2147483648, I get 'Unknown error parsing query'. Any numbers 'bigger' than this value aren't accepted.

I've tried passing the large number in quotes, but (I assume because the field is of type Number) I get 'ERROR at Row:1:Column:42 value of filter criterion for field 'custom_field' must be of type double and should not be enclosed in quotes'

I've tried prefixing the number with 'd' to note it's a double, in case it wasn't perceived as such but that didn't work either.

Any help would be greatly appreciated.

2

Did you try this recommendation : https://developer.salesforce.com/forums?id=906F00000008rBtIAI

what if you pass the query as SELECT x FROM y WHERE custom_field = 2147483648.0(.0 is the scale which is missing in your query) so that the system understands it as double and not integer. As per this Doc

http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_field_types.htm

A Number custom field is internally represented as a field of type double. Setting the scale of the Number field to 0 gives you a double that behaves like an int.

I checked in DEVELOPER CONSOLE that the max Int val is 2147483649

enter image description here

When I scale the integer and add .0 I had no issues with this query :

list acc = [SELECT Id FROM Account WHERE Case_Count__c =: 2147483649.0];

enter image description here

  • Excellent, that looks like what I needed. Many thanks! – user3365989 Feb 28 '14 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.