You need to sign in to do that
Don't have an account?
Compile Error: Arithmetic expressions must use numeric arguments at line
Hi All,
I am writting a trigger in which I am using:
Testpro__c.AllowableLimit__c = Testpro__c.AllowableLimit__c-i;
Where i is an integer, with value=1 where as AllowableLimit__c is a field of number type and have default value of 10,
When in my trigger I am trying to save this line- I am getting error:
Error: Compile Error: Arithmetic expressions must use numeric arguments at line 12 column 32
My full trigger code is:
trigger testpatpro on Testpatient__c (before insert, before update, after insert) {
Integer i;
i=1;
for ( Testpatient__c T : Trigger.New)
{
if(Testpatient__c.Testpro__c!= Null)
{
Testpro__c.AllowableLimit__c = Testpro__c.AllowableLimit__c -i ;
System.debug('Test');
}
}
}
where Testpatient__c and Testpro__c object have look up relationship.
I know its due to mismatch of Datatype, any idea how I can rectify it (at line# 12)
Thanks
Well seems like "AllowableLimit__c" is not a number field.
Make sure it is defined as Number field.
Go to field and check the field Datatype. Most probably its a text
I think it's just a syntax issue...
You're looping through the Testpatient__c records and declaring each iteration with a variable of T... but when you accessing the properties you're not using the variable of T. Try this: