1

Can any one help me out of this Error and Suggest me on the Code written .

I have created a vf page on Quote Object ,which should be generated in PDF .I have other objects which are has a relation ship on quote object such as quotelineitems , opportunity , account and few object which does not have a relationship on quote object such as student.Now i would like to get display all the field in a table .So written a wrapper class based on the controller .

ANY HELP IS VERY MUCH APPRECIATED

  1. Error in VF page as : Unknown property 'QuoteStandardController.Student' ,
  2. Apex class as :Error Error: Compile Error: unexpected token: 'public' at line 40 column 0
  3. How to get the rows and colums in a table using html.it just displays the field names ,but not in a table format
  4. How to query the Product2 field on Quotelineitems and RecordType on Account obj.

Here is my VF Code and the class

<apex:page standardController="Quote" extensions="QuoteContentController"
        applyHtmlTag="false" renderAs="PDF" showheader="false">

    <head>
        <link href="{! $Resource.advancedpdfresource }" rel="stylesheet" type="text/css"/>
    </head>

    <div class="title">RFQ Information {!Quote.Name}</div>

    <h1>General Inforamtion</h1>
    <table class="detailList" border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr width="100%">
            <td class="labelCol">Customer Name</td>
            <td class="data2Col"><apex:outputField value="{!Quote.Name}"/></td>
        </tr>
        <tr>
            <td class="labelCol">Price</td>
            <td class="data2Col"><apex:outputField value="{!Quote.Totalprice}"/></td>
        </tr>
        <tr>
            <td class="labelCol">Subtotal</td>
            <td class="data2Col">{!Quote.Subtotal}</td>
        </tr>
        <tr>
            <td class="labelCol">BillingName</td>
            <td class="data2Col">{!Quote.BillingName}</td>
        </tr>
        <tr>
            <td class="labelCol">Opportunity Name</td>
            <td class="data2Col"><apex:outputField value="{!Quote.Opportunityid}"/></td>
        </tr>
       <!-- <tr>
            <td class="labelCol">Product</td>
            <td class="data2Col"><apex:outputField value="{!Quote.QuoteLineItems__c.Product2}"/></td>
        </tr>-->
    </table>
    <!--<p>This document was created {!Now}.</p>-->

   <h1>QuotelineItems</h1>
    <table class="bordered">
        <thead>
            <tr>
                <th class="bordered">PartNumbers</th>
                <th class="bordered">Price</th>
                <th class="bordered">Quantity</th>
                <th class="bordered">EndcustomerPrice</th>
                <th class="bordered">TotalPrice</th>
            </tr>
        </thead>
        <tbody>
            <apex:repeat value="{!Quote.QuotelineItems}" var="qli">
            <tr>
                <td class="bordered"><apex:outputText value="{!qli.Product2}"/></td>
                <td class="bordered"><apex:outputText value="{!qli.Unitprice}"/></td>
                <td class="bordered"><apex:outputField value="{!qli.Quantity}"/></td>
                <td class="bordered"><apex:outputField value="{!qli.Description}"/></td>
                <td class="bordered"><apex:outputField value="{!qli.TotalPrice}"/></td>
            </tr>
            </apex:repeat>
        </tbody>
    </table> 


  <h1>Justification and Account</h1>
    <table class="bordered">
        <thead>
            <tr>
                <th class="bordered">RFQ Justification</th>
                <th class="bordered">RecordType</th>
                <th class="bordered">no_of_opportunities</th>
                <th class="bordered">Description</th>
                <th class="bordered">pi_score</th>
            </tr>
        </thead>
        <tbody>
            <apex:repeat value="{!Quote.Account}" var="a">
            <tr>
                <td class="bordered"><apex:outputText value="{!a.name}"/></td>
                <td class="bordered"><apex:outputText value="{!a.RecordType}"/></td>
                <td class="bordered"><apex:outputField value="{!a.no_of_opportunities__c}"/></td>
                <td class="bordered"><apex:outputField value="{!a.Description}"/></td>
                <td class="bordered"><apex:outputField value="{!a.pi_score__c}"/></td>
            </tr>
            </apex:repeat>
        </tbody>
    </table> 


    <!-- Wrapper Class -->
    <h1>Student</h1>
    <table class="bordered">
        <thead>
            <tr>
                <th class="bordered">Studentname</th>
                <th class="bordered">StudentDOB</th>
                <th class="bordered">StudentSkills</th>
                <th class="bordered">StudentLocation</th>
                <th class="bordered">StudentResult</th>
            </tr>
        </thead>
        <tbody>
            <apex:repeat value="{!Student}" var="std">
            <tr>
                <td class="bordered"><apex:outputText value="{!std.name}"/></td>
                <td class="bordered"><apex:outputText value="{!std.StudentDOB__c}"/></td>
                <td class="bordered"><apex:outputField value="{!std.StudentSkills__c}"/></td>
                <td class="bordered"><apex:outputField value="{!std.StudentLocation__c}"/></td>
                <td class="bordered"><apex:outputField value="{!std.StudentResult__c}"/></td>
            </tr>
            </apex:repeat>
        </tbody>
    </table> 

</apex:page>

Apex Class :

public with sharing class QuoteContentController {

    public QuoteContentController(ApexPages.StandardController controller) {

    }

//public  QuoteContentcontroller()
//public  QuoteLineItem(get;set;)
// Creating lists for the object Quote ,Quotelineitems ,Account and opportunity & opportunity forecast(wrapper class).
list<Quote> q = new list<Quote>();
list<QuoteLineItem> quoteLineItems = new list<QuoteLineItem>();
list<Account> account = new list<Account>();
list<Opportunity>opportunity = new list<Opportunity>();

// Creating List for Wrapper class

public List<wrapper> Student = new List<wrapper>();

// Get method calling from PageBlockTable and return the list of wrapper to Table

public List<wrapper> Student() {

  q = [select id , name ,BillingName from Quote];
 quoteLineItems = [select id, UnitPrice ,Quantity ,Description ,TotalPrice from QuotelineItem ];
 account =[select id , name ,  description from Account];
 opportunity =[select id , name from Opportunity];

 for(Integer i=0;i<q.size();i++){
Student.add(new wrapper(q[i].name,q[i].id,q[i].BillingName,
                        quoteLineItems[i].id,quoteLineItems[i].Product2,quoteLineItems[i].UnitPrice,quoteLineItems[i].Quantity,quoteLineItems[i].Description,quoteLineItems[i].TotalPrice,
                        account[i].id,account[i].name,account[i].recordtype,account[i].Description,
                        opportunity[i].id,opportunity[i].name));

}

return Student;

// Wrapper Class Construction

public  class wrapper{

public String Qname{get;set;}

public String QBillingName{get;set;}

public String QLIProduct2{get;set;}

public String QLIUnitprice{get;set;}

public String QLIQuantity{get;set;}

public String QLIDescription{get;set;}

public String QLITotalprice{get;set;}

public String AName{get;set;}

public String Arecordtype{get;set;}

public String ADescription{get;set;}

public String OppName{get;set;}
// Wrapper class constructor

public wrapper(String Qname,String QBillingName,String QLIProduct2,String QLIUnitprice,String QLIQuantity,String QLIDescription,String QLITotalprice,String AName,String Arecordtype,String ADescription,String OppName){

this.Qname=Qname;

this.QBillingName=QBillingName;

this.QLIProduct2=QLIProduct2;

this.QLIUnitprice=QLIUnitprice;

this.QLIQuantity=QLIQuantity;

this.QLIDescription=QLIDescription;

this.QLITotalprice=QLITotalprice;

this.AName=AName;

this.Arecordtype=Arecordtype;

this.ADescription=ADescription;

this.OppName=OppName
}

}
  • 3
    The error is pretty obvious. It does not expect to see the public keyword yet. Look at your code and think about why it should not see Public at that line. It is pretty obvious. Sorry, just want you to do a little bit of the legwork here as this is a very basic error...... – Eric Nov 28 '14 at 18:33
  • 3
    And on 1), you need to change public List<wrapper> Student() { to public List<wrapper> getStudent() { as that is the required naming pattern. Indenting your code consistently will make it easier to spot errors such as your 2). Its worth the effort when your are writing the code and it pays off in the future too by helping others understand your code when they have to modify it. – Keith C Nov 28 '14 at 18:36
  • Run your code through this: codebeautify.org/javaviewer. You probably haven't closed off a method properly. As Keith C says, it will help you and also, importantly help others to help you. – Caspar Harmer Mar 29 '15 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.