+ Start a Discussion
deva mdeva m 

newreg Compile Error: Condition expression must be of type Boolean at line 54 column

Hi ,
this is deva
Could you please resolve this.

Thanks a ton.

apex class


public class Registration {

public Registration__C str;

    public PageReference Cancel() {
        return null;
    }




    public Registration(ApexPages.StandardController controller) {
this.str = (Registration__C)Controller.getRecord();
    }
     public Registration__c getStr(){
    return str;
    }
    
    public ApexPages.PageReference save() {
 
  ApexPages.StandardController controller = new ApexPages.StandardController(str);
  try {
    controller.save();
  }
  catch(Exception e) {
    return null;
  }
  return controller.view();
}
    


public String classvalue{get;set;}
public Boolean ClassValue1{set;get;}
public Boolean ClassValue2{set;get;}
public Boolean ClassValue3{set;get;}
public Boolean ClassValue4{set;get;}
public Boolean ClassValue5{set;get;}
public Boolean ClassValue6{set;get;}
public Boolean ClassValue7{set;get;}
public Boolean ClassValue8{set;get;}
public Boolean ClassValue9{set;get;}
public Boolean ClassValue10{set;get;}
public Boolean ClassValue11{set;get;}
public Boolean ClassValue12{set;get;}
public Boolean ClassValue13{set;get;}
   
   
        
        
    public void ClassPicklist()
    {
        
        if(str.class__C=='Pre-Kg')
        {
          ClassValue1 = true;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = false;
        }
        else
        if(str.class__C='LKG')
        {
          ClassValue1 = false;
          ClassValue2 = true;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = false;
        }
        else
        if(str.class__C=='UKG')
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = true;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = false;
        }
        else
        if(str.class__C=='1stClass')
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = true;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = false;
        }
        else
        if(str.class__C=='2nd Class')
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = true;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = false;
        
        }
        else
        if(str.class__C=='3rd Class')
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = true;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = false;
        }
        else
        if(str.class__C=='4th Class')
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = true;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = false;
        }
        else
        if(str.class__C=='5th Class')
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = true;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = false;
        }
        else
        if(str.class__C=='6th Class')
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = true;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = false;
        }
        else
        if(str.class__C=='7th Class')
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = true;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = false;
        }
        else
        if(str.class__C=='8th Class')
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = true;
           ClassValue12 = false;
           ClassValue13 = false;
        }
        else
        if(str.class__C=='9th Class')
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = true;
           ClassValue13 = false;
        }
        else
        if(str.class__C=='10th Class')
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = true;
        }
        else
        {
          ClassValue1 = false;
          ClassValue2 = false;
           ClassValue3 = false;
           ClassValue4 = false;
           ClassValue5 = false;
           ClassValue6 = false;
           ClassValue7 = false;
           ClassValue8 = false;
           ClassValue9 = false;
           ClassValue10 = false;
           ClassValue11 = false;
           ClassValue12 = false;
           ClassValue13 = false;
         }
     }   
       
    public PageReference Edit() {
        return null;
    }


   
    
    
    
    public String Feevalue{get;set;}
    public Boolean FeeValue1{set;get;}
    public Boolean FeeValue2{set;get;}
    public Boolean FeeValue3{set;get;}
      public List<SelectOption> getFeelist ()
    {
      
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('','--None--'));
        options.add(new SelectOption('1','1st term'));
        options.add(new SelectOption('2','2nd Term'));
        options.add(new SelectOption('3','3rd Term'));
         return options;
    }  
          
    public void FeePicklist()
    {
        Registration__c r=new Registration__C();
        if(Feevalue=='1')
        {
          FeeValue1 = true;
          FeeValue2 = false;
          FeeValue3 = false;
         }
         else
         if(Feevalue=='2')
        {
          FeeValue1 = false;
          FeeValue2 = true;
          FeeValue3 = false;
         }
         else
         if(Feevalue=='3')
        {
          FeeValue1 = false;
          FeeValue2 = false;
          FeeValue3 = true;
         }
         else
         
        {
          FeeValue1 = false;
          FeeValue2 = false;
          FeeValue3 = false;
         }
      }
      
      
      
      
    
    public String HostalFeevalue{get;set;}
    public Boolean HostalFeeValue1{set;get;}
    public Boolean HostalFeeValue2{set;get;}
    public Boolean HostalFeeValue3{set;get;}
      public List<SelectOption> getHostalFeelist ()
    {
      
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('','--None--'));
        options.add(new SelectOption('1','1st term'));
        options.add(new SelectOption('2','2nd Term'));
        options.add(new SelectOption('3','3rd Term'));
         return options;
    }  
          
    public void HostalFeePicklist()
    {
        Registration__c r=new Registration__C();
        if(HostalFeevalue=='1')
        {
          HostalFeeValue1 = true;
          HostalFeeValue2 = false;
          HostalFeeValue3 = false;
         }
         else
         if(HostalFeevalue=='2')
        {
          HostalFeeValue1 = false;
          HostalFeeValue2 = true;
          HostalFeeValue3 = false;
         }
         else
         if(HostalFeevalue=='3')
        {
          HostalFeeValue1 = false;
          HostalFeeValue2 = false;
          HostalFeeValue3 = true;
         }
         else
         
        {
          HostalFeeValue1 = false;
          HostalFeeValue2 = false;
          HostalFeeValue3 = false;
         }
   }

}


Here clas__C is picklist field and registration__c is object

Based on classvalue i have to render the code
John PipkinJohn Pipkin
The line:
 
if(str.class__C='LKG')

should be: 
if(str.class__C=='LKG')

That should fix the issue.
John PipkinJohn Pipkin
Deva, 

If that solved your issue, please mark this as "Solved" by selecting the best answer. 
SpoorthySpoorthy
I too had a same issue and the above solution did work. Thanks John