+ Start a Discussion
Andrew Perez 2Andrew Perez 2 

Building a visualforce table.

I'm trying to build a table using Vf combining data from two custom objects. The table will need to report on a specific record and also use formulas in the code to calculate output data.

I have some code but not sure if i'm even heading the right direction.  Any help would be greatly appreciated.
<apex:page  standardController="Professional_Service_Estimate__c" extensions="summary_table_ext">  
    <apex:form id="formId">
        
        <apex:pageBlock>
        	<apex:inputfield value="{!Professional_Service_Estimate__c.Name}"/>
		</apex:pageBlock>  
            
       <apex:pageBlock title="Estimated Professional Services Fees">
            <apex:pageBlockTable value="{!estimate_list}" var="el">
                <apex:column headerValue="Cost Breakdown - EDRC - AE %">
                    <apex:outputText value="{!el.Current_Fee__c} + {!el.What_s_Added_b_c_of_salary_escalation__c} + {!el.Added_b_c_of_Construction_Escalation_ECC__c}"  />
                </apex:column>
                <apex:column headerValue="State">
                    <apex:outputField value="{!st.State__c}" />
                </apex:column>
                <apex:column headerValue="Building Type">
                    <apex:outputField value="{!st.Building_Type__c}" />
                </apex:column>
        	</apex:pageBlockTable>
        </apex:pageBlock>
        
        <apex:pageBlock title="Project Details">
            <apex:pageBlockTable value="{!estimate_list}" var="st">
                <apex:column headerValue="City">
                    <apex:outputField value="{!st.City__c}" />
                </apex:column>
                <apex:column headerValue="State">
                    <apex:outputField value="{!st.State__c}" />
                </apex:column>
                <apex:column headerValue="Building Type">
                    <apex:outputField value="{!st.Building_Type__c}" />
                </apex:column>

                <apex:column headerValue="CECC">
                    <apex:outputField value="{!st.CECC__c}" />
                </apex:column>
                <apex:column headerValue="ECC">
                    <apex:outputField value="{!st.ECC__c}" />
                </apex:column>
                <apex:column headerValue="Estimated Total GSF">
                    <apex:outputField value="{!st.Estimated_Total_GSF__c}" />
                </apex:column>
                
                <apex:column headerValue="Anticipated Date of Design Award">
                    <apex:outputField value="{!st.Anticipated_Date_of_Design_Award__c}" />
                </apex:column>
                <apex:column headerValue="Anticipated Start Date of Construction">
                    <apex:outputField value="{!st.Anticipated_Start_Date_of_Construction__c}" />
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

VF:
public class summary_table_ext {

    public List<Professional_Service_Estimate__c> service_list {get; set;}
    public List<Professional_Service_Estimate_List__c> estimate_list {get; set;}

    public summary_table_ext(ApexPages.StandardController controller) {
        
        service_list = [SELECT Id, City__c, State__c, ECC__c, CECC__c, Estimated_Total_GSF__c, Anticipated_Date_of_Design_Award__c, Anticipated_Start_Date_of_Construction__c,Time_until_Midpoint_of_Design_years__c,
                        Building_Type__c
       
                        FROM Professional_Service_Estimate__c];

        estimate_list = [SELECT Id, Added_b_c_of_Construction_Escalation_ECC__c, What_s_Added_b_c_of_salary_escalation__c, Current_Fee__c,
                     	EDRC_EMIC_Type__c, Escalated_by_Salary__c, Future_Fee_ECC__c, Percentage_ECC__c, Percentage__c, Professional_Service_Estimate__c,
                     	Type__c
                        FROM Professional_Service_Estimate_List__c];
    }
}

 
VineetKumarVineetKumar
Yes, your are going in the right direction.
Andrew Perez 2Andrew Perez 2
I'm running into this error: Unknown property 'Professional_Service_Estimate__cStandardController.st'

Would you be able to help me out?
VineetKumarVineetKumar
I suppose there was a copy paste error on your page.
Second page block was using variable that was not at all defined (defined in third page block)
Refer the below code : Line 8-20
<apex:pageBlock title="Estimated Professional Services Fees">
	<apex:pageBlockTable value="{!estimate_list}" var="el">
		<apex:column headerValue="Cost Breakdown - EDRC - AE %">
			<apex:outputText value="{!el.Current_Fee__c} + {!el.What_s_Added_b_c_of_salary_escalation__c} + {!el.Added_b_c_of_Construction_Escalation_ECC__c}"  />
		</apex:column>
		<apex:column headerValue="State">
			<apex:outputField value="{!el.State__c}" />
		</apex:column>
		<apex:column headerValue="Building Type">
			<apex:outputField value="{!el.Building_Type__c}" />
		</apex:column>
	</apex:pageBlockTable>
</apex:pageBlock>