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
degmodegmo 

Number field type in apex

Hi,
I have a field defined as number(16,2).  If I put in the value 0, SF UI shows 0.0 but in the database it is saved as 0 without the decimal points.  I have a web application that integrates with SF and the web application passes me a value for this field as a string to filter.  So, in my apex code, I need to do "double.valueOf(field)".  However, if the web application passes me a "0", my SOQL won't return anything b/c it will convert it to 0.00 but it's stored as a "0" in the DB.  How can I solve this problem?
Shubham Jain 338Shubham Jain 338
Hi degmo,

Both queries result in the same data

select id,Test__c from Opportunity where Test__c = 0.00
select id,Test__c from Opportunity where Test__c = 0

Please mark this as the best answer if it helps

Thanks
Shubham Jain