You need to sign in to do that
Don't have an account?
Bill Button
arguments must be compatible types schema.SObjectField, Integer
Hi,
Not sure why I am getting this error or how to get round it, the field has been defined as a Number(1,0) but I get an error when I compare this to 0 or 1. The filed has 3 possible values 0,1,2 currently.
public String Edgecam_BGColor() {
string BGColor = '';
// ss_edgecam__c is defined as Number(1, 0)
// but on the if's I get an error when saving
// Comparison arguments must be compatible types
// schema.SObjectField, Integer
if (account.ss_edgecam__C == 0) {
BGColor = '';
} else if (account.ss_edgecam__C == 1) {
BGColor = '#C0FFC0';
} else {
BGColor = '#FFC0C0';
}
return BGColor;
string BGColor = '';
// ss_edgecam__c is defined as Number(1, 0)
// but on the if's I get an error when saving
// Comparison arguments must be compatible types
// schema.SObjectField, Integer
if (account.ss_edgecam__C == 0) {
BGColor = '';
} else if (account.ss_edgecam__C == 1) {
BGColor = '#C0FFC0';
} else {
BGColor = '#FFC0C0';
}
return BGColor;
Even if you create a number as (1,0) in the UI it is stored as a Double 0.0.
Either add 0.0 to your compare in your if statements, or use Integer.valueOf(account.ss_edgecam__C) == 0.
this.acct = (Account)stdController.getRecord();
}
string BGColor = '';
// ss_edgecam__c is defined as Number(1, 0)
// but on the if's I get an error when saving
// Comparison arguments must be compatible types
// schema.SObjectField, Integer
if (this.acct.ss_edgecam__C == 0) {
BGColor = '';
} else if (this.acct.ss_edgecam__C == 1) {
BGColor = '#C0FFC0';
} else {
BGColor = '#FFC0C0';
}
return BGColor;
}
}