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
hemmhemm 

Compile Error: For input string: "16000000000"

I am able to add 16000000000 as a value into the Annual Revenue field on account, but if I try and look for accounts with a value greater than that in Apex or the API, I get a

 

Compile Error: For input string: "16000000000"

 

 

account a = [select id, annualrevenue from account where annualrevenue > 16000000000 limit 1][0];

 

Ideas?

 

BrendaFlynnBrendaFlynn
What is the data type for annualrevenue? I wonder if you need to cast the value of annual revenue, or possibly escape your 16000000000 with quotes. I'm guessing you don't REALLY mean companies with annual revenue higher than 16 trillion, unless maybe you're working in a Zimbabwean currency or something. (Which I suppose is a possibility!)
hemmhemm

I am really passing along a question from a client.  No, the number is not really a practical one, but since the standard field on Accounts called Annual Revenue lets you enter 16000000000, you should be able to query for it.

 

Maybe an extreme example, but one that demonstrates where the UI functionality and the API/Apex may not align.

 

The AnnualRevenue field I am referring to is the one that comes standard from Salesforce on Accounts.

 

This works

account a = [select id, annualrevenue from account where annualrevenue > 1600000000 limit 1][0];

 

This doesn't

account a = [select id, annualrevenue from account where annualrevenue > 16000000000 limit 1][0];

 

Both values can be entered on an Account in the UI.

 

 

hemmhemm

Anyone know the issue?

 

That number is 16 billion, not trillion. I have a customer that tracks governmental budgets and they need to query up ones with revenues greater than a certain value.  16 billion for many governments is normal.  Either way, they use these numbers and Apex (and the API) give this error.

hemmhemm

I found the answer on another post (http://community.salesforce.com/t5/NET-Development/Malformed-query-exception-please-help/m-p/97671#M6761)

 

It has something to do with data types with Salesforce.  If you add a decimal point and make it 16000000000.0, it works.

Juan Miguel Mendoza CruzJuan Miguel Mendoza Cruz
Hi Hemm,

Many years later, salesforce has the same error and I have to say, THANK YOU!

I had the same with a query in flow, and adding a decimal point to the number works.