You need to sign in to do that
Don't have an account?
SOQL and VF
Hi All, I've been banging my head against the wall I have a SOQL queery and pull out the information as below into two lists.
for(Project_Activity__c p : ProjectActivityList)
{
ProjList.add(p);
for(Time_Sheet__c t : p.Time_Sheets__r)
{
TimeSheetList.add(t);
}
}
So i have projects and then time sheets under that. Does anyone know of a way i can represent this in visual force? any help would be great as im really stuck. I tried the iframe route but i need to be able to edit the time sheets and save them back.
Thanks for any help guys.
Cheers sir thats spot on, what i did fine though is that you cant embed apex:column in a repeat there are a few postings on this it looks like its something thats being worked on at salesforce but you can do this:
<apex:repeat value="{!ProjectActivityList}" var="p" >
<apex:outputText value="{!p.Name}" /><br/>
<apex:outputPanel >
<apex:outputText value="{Time Sheets}" /><br/>
<table>
<tr>
<th>Total Hours</th>
<th>Submitted Date</th>
<th>Input Test</th>
</tr>
<apex:repeat value="{!p.Time_Sheets__r}" var="t">
<tr>
<td>
<apex:outputText value="{!t.Total_Hours__c}" />
</td>
<td>
<apex:outputText value="{0,date,dd'/'MM'/'yyyy}">
<apex:param value="{!t.Submitted_Date__c}"/>
</apex:outputText>
</td>
<td>
<apex:inputfield value="{!t.Time_Of_Day__c}" />
</td>
</tr>
and that works like a charm.
Thanks.
All Answers
You could use a nested repeat on your page, then you wouldn't need to process this double for loop.
Then use a custom save in your controller to save the timesheet changes
with an "update ProfectActivityList.Time_Sheets__r" type of command.
Hope this gets you pointed in the right direction.
Cheers sir thats spot on, what i did fine though is that you cant embed apex:column in a repeat there are a few postings on this it looks like its something thats being worked on at salesforce but you can do this:
<apex:repeat value="{!ProjectActivityList}" var="p" >
<apex:outputText value="{!p.Name}" /><br/>
<apex:outputPanel >
<apex:outputText value="{Time Sheets}" /><br/>
<table>
<tr>
<th>Total Hours</th>
<th>Submitted Date</th>
<th>Input Test</th>
</tr>
<apex:repeat value="{!p.Time_Sheets__r}" var="t">
<tr>
<td>
<apex:outputText value="{!t.Total_Hours__c}" />
</td>
<td>
<apex:outputText value="{0,date,dd'/'MM'/'yyyy}">
<apex:param value="{!t.Submitted_Date__c}"/>
</apex:outputText>
</td>
<td>
<apex:inputfield value="{!t.Time_Of_Day__c}" />
</td>
</tr>
and that works like a charm.
Thanks.