0

When I execute an SOQL query on my currency field (5,2) length, Im getting this value as a result:

3E-13 What it does mean and how could I get the actual value?

Same if I do it through Anonymous:

List<Opportunity> oppList = [SELECT ID, Name, myfield__c, FROM Opportunity WHERE 
Id = 'my_ID'];

System.debug(oppList[0]);

Im getting this result:

|USER_DEBUG|[4]|DEBUG|Opportunity:{Id=my_id, Name=name lastname, myfield__c=3E-13}

I have few records with this kind of result, here is another one:

value-isse

2
  • SQL and SOQL are different query languages and used in completely different products.
    – Adrian Larson
    Commented Aug 17, 2023 at 13:49
  • Thank you for the edit.
    – BoDiE2003
    Commented Aug 17, 2023 at 13:51

3 Answers 3

4

Defining a numeric (X, Y) field, only restricts the precision of the field on UI level.
You can store up to 24 decimal points via API or APEX, regardless of the decimal places provided in the field definition. Therefore if you retrieve the record via API or APEX, you'll see the real value, not the rounded up one.
That's why you see 3E-13.

You could easily test it in a trailhead org updating an Account via anonymous apex setting AnnualRevenue = 0.00000000000003;, then retrieving it via SOQL and printing the field's value: it'll show 3E-13. While if you open its record page you'll see 0.
AnnualRevenue is a currency (18,0) field.

2

3E-13 is standard form notation. It means 3 × 10-13. That is 0.0000000000003.

1

Currently this is working as expected. Please look at this article https://help.salesforce.com/s/articleView?id=000385889&type=1

It will explain you how... There is an idea for it.. Please vote...

You must log in to answer this question.

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