1

I have a SOQL query that pulls back 3 records with data from 5 fields into my NSDictionary. One of the fields in Salesforce is numeric (currency) and is returned in the query as a double. When I insert the value from the NSDictionary into the textlabel.text I don't have any success, i.e., no value is instered. Is my syntax incorrect at the point of insertion? Should I be converting it to text?

cell.textLabel.text = [obj objectForKey: @"Sales_rev__c" ];

1 Answer 1

2

Have you tried using stringWithFormat to do the type conversion?

cell.textLabel.text = [NSString stringWithFormat:@"%f", [obj objectForKey: @"Sales_rev__c"]];
1
  • Thanks, I just tried that but the number value isn't returned, I just get 0.000000 returned instead (although on inspection at run time in the dictionary *obj there are two records that have a value greater than zero). I get the warning on the syntax: Format specifies type "double" but the argument has type "id".
    – Bartley
    Sep 11, 2013 at 9:22

You must log in to answer this question.

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