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

Method does not exist or incorrect signature: [LIST:Decimal].get(String) ????

Hi :

   If I have:


List<Decimal> rTypes2 = new List<Decimal>(); for(Account rType :[SELECT Term FROM Subject]) { rTypes2.add(rType.Term); } for(Account{ if(rTypes2.get('Term') = 9.1) {} } I am getting an error on rTypes2.get('Term')?????


I am getting an error on rTypes2.get('Term')?????


I don't want to make it sound too simple.  You might have already considered that the field "Term" is a string field and not a decimal.  There are methods you can use to convert it in apex ... not in SOQL.  I don't have the method on the tip of my tongue but for Integers it is x.intValue(), so my first guess would be x.decimalValue().  Where x is Term.
P.S. Try x = double.valueOf(term)??

Hi Doc.. Thanks for the reply.. So I tried the following:


(Decimal)rTypes2.get('Term')<==No work double.Valueof(rTypes2.get('Term'))<==nope rTypes2.get('Term').decimalValue(); <== nope rTypes2.get('Term.decimalValue()'); <== nope





Boy.  I can understand the fustration.  I have a lot of post with false leads.  Try this:




If this does not work search on "valueOf" for more help.