Skip to main content
Amanda Abelove が「#Visualforce」で質問
I created a new quoting tool to replace the default quote tool so that we can generate quotes according to our business rules. I want to generate a quote with a series of packages and and a list of their components that looks like this:

Quote for %OPPORTUNITY_NAME%

%PACKAGE_NAME_1%             %PRICE%

   %COMPONENT A%

   %COMPONENT B%

   %COMPONENT C%

%PACKAGE_NAME_2%             %PRICE%

   %COMPONENT A%

   %COMPONENT B%

   %COMPONENT D%

I tried to follow the instructions in this solution (http://salesforce.stackexchange.com/questions/3836/how-to-use-nested-repeat-function-in-visualforce-page) but can't get it to work. I am as far in as trying to create the controller, but I keep getting the error message:     

Error: ab_quote_summaryController Compile Error: unexpected token: ')' at line 7 column 61    

The controller code I tried to write is:

 

public with sharing class ab_quote_summaryController

{

public Quote_Package__c abpackage {get; set;}

public list<Quote_Line_Items__c> componentList {get; set;}

public ab_quote_summaryController(Quote_Package__c);

{

abpackage = p;

componentList = new list<Quote_Line_Items__c>();

}

}

Does anyone know how to fix it so it doesn't have an unexpected token? The solution also goes on to state: "You build up a list of these entries in your controller code" but I'm also not clear how I would do that.  Am I even doing the right thing to acheive my business goal? 

Newbie programmer here. Help appreciated!!!

4 件の回答
  1. 2015年2月27日 22:41

    That got me a little closer...  The next part of the solution was also difficult to follow...  I tried to create the page so that I can see how much the controller is actually printing....  None of it :(.  

    From other tutorials, I know that I need to select the fields I want to display using the controller... I added them below your statements, which were error free... but now I get the error:

    Error: ab_quote_summaryController Compile Error: unexpected token: 'from' at line 22 column 44

     

    public with sharing class ab_quote_summaryController

    {

    public Quote_Package__c abpackage {get; set;}

    public list<Quote_Line_Items__c> componentList {get; set;}

    public ab_quote_summaryController()

    {

    }

    public ab_quote_summaryController(Quote_Package__c p)

    {

    abpackage = p;

    componentList = new list<Quote_Line_Items__c>();

    }

    public ab_quote_summaryController(Opportunity opf)

    {

    opportunity = [select id, Name, from Opportunity];

    }

    public ab_quote_summaryController(AB_Quote_c abqf)

    {

    abquote = [select id, Name, from AB_Quote_c];

    }

    public ab_quote_summaryController(Quote_Package__c pf)

    {

    packages = [select id, Name, Package_Price__c from Quote_Package__c ];

    }

    public ab_quote_summaryController(Quote_Line_Items__c cf)

    {

    components = [select id, Name from Quote_Line_Items__c ];

    }

    public ab_quote_summaryController(Ala_Carte_Line_Items__c aclf)

    {

    components = [select id, Name, Price from Ala_Carte_Line_Items__c ];

    }

    }

    I also created the following page layout:01 <apex:page controller="ab_quote_summaryController">

     

    <apex:page controller="ab_quote_summaryController">

    <h1>Quote for {!opf.opportunity.Name}</h1>

    <p>{!abqf.abquote.Name}</p>

    <h2>Packages</h2>

    <table>

    <apex:repeat value="{!abpackage}" var="p">

    <tr style="font-size:14px;">

    <td>{!pf.abpackage.Name}</td>

    <td></td>

    <td>{!pf.abpackage.Price}</td>

    </tr>

    <apex:repeat value="{!p.componentList}" var="cl">

    <tr style="font-size:14px;">

    <td></td>

    <td>

    {!cf.components.Name}

    </td>

    <td></td>

    </tr>

    </apex:repeat>

    </apex:repeat>

    </table>

    <h2>Ala Carte Services</h2>

    <table>

    <apex:repeat value="{!abalacarte}" var="p">

    <tr style="font-size:14px;">

    <td>{!aclf.abalacarte.Name}</td>

    <td></td>

    <td>{!aclf.abalacarte.Price}</td>

    </tr>

    </apex:repeat>

    </table>

    </apex:page>

    Your guidance and knowledge are very much appreciated!  How do I get the controller and the page layout to work correctly?  The relationships between all the objects are

    * Opportunity (Standard Salesforce object)    

    ** AB_Quote_c (Replaces the standard Salesforce quote with our custom quote)

    ***Ala_Carte_Line_Items_c (Adding services and other things to the quote)

    ***Quote_Package__c (A package that is added to AB_Quote_c as a detail)

    ****Quote_Line_Items__c (A line item for copying the component to the Quote_Package_c as a detail...  I wanted to maintain the component information on the line item separately from the component itself so that the historical record is maintained.)

     
0/9000