You need to sign in to do that
Don't have an account?
Indira Reddy 1
How to convert currency to decimal
Hi All,
I am new to Apex and trying to convert Euro to USD and save it in a custom field 'measure'. Here is my code-
CurrencyType conversionRate = [SELECT conversionrate from currencytype where isocode = 'Eur'];
newProduct.measure__c.= opplineItem.Price / (conversionRate);
I get the following error 'Arithmetic expressions must use numeric arguments'. I need to convert conversionRate to decimal. Is there anything like integer.valueof() to convert to decimal.
Thank you
I am new to Apex and trying to convert Euro to USD and save it in a custom field 'measure'. Here is my code-
CurrencyType conversionRate = [SELECT conversionrate from currencytype where isocode = 'Eur'];
newProduct.measure__c.= opplineItem.Price / (conversionRate);
I get the following error 'Arithmetic expressions must use numeric arguments'. I need to convert conversionRate to decimal. Is there anything like integer.valueof() to convert to decimal.
Thank you
please use newProduct.measure__c.= opplineItem.Price / (conversionRate.conversionrate);
All Answers
please use newProduct.measure__c.= opplineItem.Price / (conversionRate.conversionrate);