You need to sign in to do that
Don't have an account?
Mig
Convert a Picklist value to a Double value
I made a trigger that updates somes values after update. But some fields are not the same type.
Is there any functionnality ( like toString) to covnert My picklist values (String) to a double ( Like parseFloat in Javascript).
Thank you
Is there any functionnality ( like toString) to covnert My picklist values (String) to a double ( Like parseFloat in Javascript).
Thank you
Double d = Double.valueOf( str ); // str is the string u need to convert
Similar method is also available for converting string to long, integer, decimal, ...
Message Edited by Rajesh Shah on 05-22-2008 02:22 AM
All Answers
Even I want to implement the same functionality i.e to convert a string to a double.
I looked into the Apex Language Reference String methods but couldnt any such function.
Is there any other way to do it?
But as usual no example So i did the following
for (OpportunityLineItem oli : trigger.new ){
string B=oli.Billing_Term__c;
integer m = B.Integer.Format;}
and I get the following error message Error: Compile Error: Initial term of field expression must be a concrete SObject: String
Tell me if that works for you ?
It again gives the same error "Compile Error: Initial term of field expression must be a concrete SObject:"
Double d = Double.valueOf( str ); // str is the string u need to convert
Similar method is also available for converting string to long, integer, decimal, ...
Message Edited by Rajesh Shah on 05-22-2008 02:22 AM
Thank you very much !
Convert string to decimal type:
is this correct
Decimal DebitAmount = decimal.valueOf('');
Yes, it is correct. Check the following example from Apex Lang Reference
String temp = '12.4567';
Decimal myDecimal = Decimal.valueOf(temp);