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
vs94063vs94063 

Issue with using "double" type field in the query WHERE clause.

Hi,
 In one of my object i has a field whose FieldType is "double" with a precision of 18 and a scale of 0.
When I use this field in the query WHERE clause "double_field1 = 12312312312", running the query fails with an error "MALFORMED_QUERY" but when i use the WHERE clause "double_field1 = 12312312312", it query runs fine (note that this value is one digit less than the previous one).

I was expecting that i should be able to supply an 18-digit number as the filter value (since the precision was 18 and scale was 0), is my understanding correct?

Let me know how to fix this issue.

Thank you

LosintikfosLosintikfos
Post the full query!
vs94063vs94063
Here is the query that is failing with the error MALFORMED_QUERY:

Select Id, IsDeleted, AccountId, IsPrivate, Name, Description, StageName, Amount, Probability, ExpectedRevenue, TotalOpportunityQuantity, CloseDate, Type, NextStep, LeadSource, IsClosed, IsWon, ForecastCategory, ForecastCategoryName, CampaignId, HasOpportunityLineItem, Pricebook2Id, OwnerId, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, LastActivityDate, FiscalQuarter, FiscalYear, Fiscal, DeliveryInstallationStatus__c, TrackingNumber__c, OrderNumber__c, CurrentGenerators__c, MainCompetitors__c From Opportunity Where TotalOpportunityQuantity = 12312312312


Please note that TotalOpportunityQuantity field's FieldType is "double" with a precision of "18" and a scale of "2".

But in the Where clause, if i use "TotalOpportunityQuantity = 1231231231", it works fine.

Thanks
LosintikfosLosintikfos
If the value you expect to select isEqualto 12312312312 then obviously your query can be modified like this also to work;

Code:
Select Id, IsDeleted, AccountId, IsPrivate, Name, Description, 
StageName, Amount, Probability, ExpectedRevenue, TotalOpportunityQuantity,
 CloseDate, Type, NextStep, LeadSource, IsClosed, IsWon, ForecastCategory,
ForecastCategoryName, CampaignId, HasOpportunityLineItem, Pricebook2Id, OwnerId,
 CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp,
LastActivityDate, FiscalQuarter, FiscalYear, Fiscal, DeliveryInstallationStatus__c,
 TrackingNumber__c, OrderNumber__c, CurrentGenerators__c, MainCompetitors__c From
Opportunity Where TotalOpportunityQuantity = '12312312312'

 This will map the value passed in the query to the value you seek to fetch!



Message Edited by Losintikfos on 10-07-2008 01:06 AM
vs94063vs94063
I tried your suggestion but it did not work. I got an error when i ran the query that contained the WHERE clause: "Where TotalOpportunityQuantity = '12312312312' " and the error is: "value of filter criterion for the field 'TotalOpportunityQuantity' must of type double and should not be enclosed in quotes".
LosintikfosLosintikfos
Was wondering doing something like this;

Code:
WHERE TotalOpportunityQuantity > 1231231231
would meet the requirement.

OR perhaps hold the double value to a Variable like;

Code:
double toquat = 12312312312;

 And pass toquat to the query statement as parameter! i know it is possible this will arrive at same error but no harm in trying.

B



Message Edited by Losintikfos on 10-08-2008 01:16 AM