0

Background

Our system contains 2 parts(Web Part and Mobile Part). And the mobile part is implemented with SFDC iOS SDK.

Issue

Recently, user reported that some data in iPad was different from the web part. We checked, the data is retrieved via iOS SDK Rest API and the value was changed.

For example:

The Base_Price__c is 74.10000 in Web. But the we got 74.09999999999999 via iOS SDK Rest API.

Why is the field of data type number storing more numbers in decimal places than defined?

Additional information

  1. It works well in the past.
  2. We tried to reset the value in Web Part, the issue still is existed.
  3. We tried with Rest API of Workbench, no issue.
  4. We tried to get the data with data loader, no issue.
  5. Field: Base_Price__c
    Data Type: Number (Number Options: Length 13 Decimal Places 5) SFDC iOS SDK :"v23.0"
  6. iOS Source: NSString * soql = select Id,.....,Base_Price__c,...... from Product__c - (SFRestRequest *)requestForQuery:(NSString *)soql;
0

The decimal places in number fields are only effective at the presentation level, not in the database. And different tools might choose to display things differently.

So, the most likely answer is that your actual database value is 74.09999999999999 but the presentation layer is rounding it when you view via the web interface.

You can confirm by doing System.debug([SELECT Id, Base_Price__c FROM Product...]) in the anonymous apex in the developer console.

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.