You need to sign in to do that
Don't have an account?
Absolute Value of a Decimal Equation
I have a trigger using a variable that is the value of an equation that I need to get the absolute value of. I can't seem to get the code to compile. Here's the error I get and my code:
Error: Compile Error: Method does not exist or incorrect signature: ABS(Double) at line 32 column 32
Decimal DiscountDiff1 = null; Decimal DiscountDiff2 = null; Opportunity O = [select Id, Discount_Rollup__c, Max_Discount__c, Discount_Approved__c, SA_Discount__c, Account.Strategic_Account_Designation__c from Opportunity where Id = :OLI.OpportunityId LIMIT 1]; DiscountDiff1 = ABS (OLI.Discount__c - O.SA_Discount__c); DiscountDiff2 = ABS (O.SA_Discount__c - OLI.Discount__c);
OLI.Discount__c & O.SA_Discount__c are both decimal (percent) fields.
Any help would be appreciated!
All Answers
Try changing your code to this:
The abs function has to be called against an instance of an decimal. It isn't a static function.