You need to sign in to do that
Don't have an account?
Angela Skenderi 2
Comparison arguments must be compatible types: Decimal, Boolean is the error that I have been receiving. What is the solution?
private Decimal getCarAllowances() {
Decimal value = 0;
for (Pay_Element__c payElement : payElements) {
if (payElement.Is_Addition__c == true &&
(payElement.Car_Allowance__c == true)) {
value += payElement.Value__c;
}
}
return value;
}
Decimal value = 0;
for (Pay_Element__c payElement : payElements) {
if (payElement.Is_Addition__c == true &&
(payElement.Car_Allowance__c == true)) {
value += payElement.Value__c;
}
}
return value;
}
The error occurs because you're trying to compare a Boolean field (payElement.Car_Allowance__c) with the true Boolean value directly.
To fix the error, you can simplify the code by removing the == true checks in your if statement like below:
If this information helps, please mark the answer as best. Thank you