You need to sign in to do that
Don't have an account?

Visualforce with SOQL relationship
Hi All i have a query ...
SELECT Name, Id, Total_Contract_Gross_Profit__c, Total_Contract_Revenue__c, Total_Contract_Sales_Margin__c, Total_Start_Up_Gross_Profit__c,
Total_Start_Up_Revenue__c, (SELECT Description__c,Name,Quantity__c,Unit_Cost__c,Unit_Price__c,Unit_Sell__c
FROM MCS_Contract_Invoice_Startup_Line_Items__r) FROM MCS_Contract_Recurring_Service_Invoice__c where id = :invoiceId
which brings back a list of invoices and related startup items.
Does anyone know how i would or what is the best practice to display the invoice followed by startup items on a visualforce page?
I tried using datatables like this
<apex:dataTable value="{!Invoices}" var="invoice">
<apex:dataTable value="{!invoices.MCS_Contract_Invoice_Startup_Line_Items__r}" var="i">
<apex:outputfield value={!Name}
but nothing ...
Any help would be great.
Thanks.
You can make use of similar HTML tags instead of apex tags in Vf page to reduce view state issue in future. Also you can use repeat tag while using the similar HTML tags for the list from controller. Here, Invoices.
You can do it in such a way:
temp =[SELECT Name, Id, Total_Contract_Gross_Profit__c, Total_Contract_Revenue__c, Total_Contract_Sales_Margin__c, Total_Start_Up_Gross_Profit__c,
Total_Start_Up_Revenue__c, (SELECT Description__c,Name,Quantity__c,Unit_Cost__c,Unit_Price__c,Unit_Sell__c
FROM MCS_Contract_Invoice_Startup_Line_Items__r) FROM MCS_Contract_Recurring_Service_Invoice__c where id = :invoiceId]
Visualforce page:
<table>
<apex:repeat value={!temp} var="t">
<tr>
<td>{!t.Name}</td>
</tr>
</apex:repeat>
</table>
Thanks guys ive got that going but what i need is something like a
page block section with the master object then underneath each master the child in another section, does that make sense?
So ive got this:
<apex:pageBlockSection title="Recurring Services">
<apex:pageBlockTable value="{!getRecurringServicesWithBreakdowns}" var="recurring">
<apex:column headerClass="headerStyle">
<apex:facet name="header">
<b class="Header">Name</b></apex:facet>
<apex:outputField value="{!recurring.Name}"/>
</apex:column>
</apex:pageblockTable>
</apex:pageBlockSection>
so i need to somehow crowbar the child objects in here ...
so i get:
Master
Child
Child
Master
Child
Child
Child
any help would be great thanks.