0

Can any one help me on this. I have a visual force page created in PDF format. If the product line for the product selected in opportunity items is ‘DIE’ make following changes .

1) Field label name to be changed from "Item" to "Binitemcode".

2)Unit price to be changed to $0.01.

Im trying to add the lines ,it throws an Error as expecting a semi-colon, found '{'

I get this error at :public string productname{

Code :

          public List<wrapperClass> getappointmentList (){
               wrapperClass tempObj ;
               tempObj = new wrapperClass();
               List<wrapperClass> aReList = new List<wrapperClass>(); 
           List<Opportunity> opp=[select id,Name,AccountId from Opportunity where id=:oppid limit 1];
           List<opportunity> Opp1=[select id,name,CreatedDate from opportunity where id=:oppid];
           //Opportunity opp1=[select id,Name,AccountId from Opportunity where id=:oppid limit 1];
           //Opportunity Opp=[select id,name,CreatedDate from opportunity where id=:oppid ];
                          List<OpportunityLineItem> OPplineitem= [SELECT OpportunityId,Quantity,PricebookEntry.Product2.Name,Sys_total_Amount__c,LN__c,Extension__c,ListPrice
                          ,Pick__c,Schedule_Ship_date__c,Bin_Item_Code__c ,PricebookEntry.Product2.Product_Line__c
                          FROM OpportunityLineItem where OpportunityId=:oppId]; 
                          system.debug('HHHHHHHHHH'+OPplineitem.size());

                          public String productname{

                          get{

                          if(OPplineitem[0].PricebookEntry.Product2.Product_Line__c=='DIE') 
                          { 
                          string productname='BinItemCode';
                          }
                          else
                          {string productname='Item';
                          }
                          return productname;
                          }
                          set;
   }
                   for(integer i=0; i < OPplineitem.size(); i++)
                   {
                     tempObj = new wrapperClass();
                     tempObj.productname= OPplineitem[i].PricebookEntry.Product2.Name;
                     tempObj.BinItemCode=OPplineitem[i].Bin_Item_Code__c;
                     tempObj.quantity=OPplineitem[i].Quantity;
                     tempObj.totalamount=OPplineitem[i].Sys_total_Amount__c;
                    // tempObj.productline=OPplineitem[i].PricebookEntry.Product2.Product_Line__c;
                     //Add a conditional statement here


                 if(OPplineitem[i].PricebookEntry.Product2.Product_Line__c=='DIE') 
                     {
                      tempObj.unitprice=0.01;
                      tempobj.extension=OPplineitem[i].Quantity * tempObj.unitprice;
                      //string productname='BinItemCode';

                     }
                 else
                     {
                     tempObj.unitprice=OPplineitem[i].ListPrice;
                     tempobj.extension=OPplineitem[i].Extension__c;
                     //String productname='Item';
                     }
                     tempobj.LineNumber=OPplineitem[i].LN__c;
                     tempobj.Pick= OPplineitem[i].Pick__c;
                     tempobj.ScheduledShipDate = Opplineitem[i].schedule_ship_date__c;

                     if(tempobj!=null){
                        aReList.add(tempObj);
                     }
                    }
           return aReList;


   }

1 Answer 1

1

You need to end your getappointmentList method before your productname method.

system.debug('HHHHHHHHHH'+OPplineitem.size());
} //you are missing this closing }

 public String productname{
 get{}
 set;
 }
3
  • :I have updated the code .I have 2 conditions,the 2nd condition works fine.For the 1st condition where i need change the label name.I have included the public string productname .This controller is written on a wrapper class.Any suggestion plz.
    – nikkey
    Commented Feb 6, 2015 at 18:51
  • That still doesn't look right. You need to move the productname method outside of your getappointmentList method.
    – TC Sutton
    Commented Feb 6, 2015 at 18:56
  • :if move the productname method outside the etappointmentList method ,it throws an error as opplineitem does not exist.
    – nikkey
    Commented Feb 6, 2015 at 19:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .