function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Wayne_ClarkWayne_Clark 

Breaking Up Visualforce Page by different field values

Is is possible for visualforce to automatically page break based on field values within a record.  Below is my Visualforce page code and controller extension.   I'm going to eventually render this as a PDF, but I wanted it to be separated based off the different the clients.  So, this page below will print out the Contacts Name and the different dates they submitted hours, along with the Client that they submitted hours against.  The problem is that it lumps all clients into the same column and into the same page.  I'm trying to get the first page to list everything submitted for Client A, then the second page to submit against Client B and so on.   Thanks in advance for any advise, even if it's to let me know it's not possible. 

 

Visualforce Page:

<apex:page standardController="Contact" extensions="TimeCardExtension" sidebar="false" showheader="false" >
<apex:pageBlock >
<apex:outputField value="{!Contact.Name}"/>
</apex:pageBlock>
<apex:dataTable value="{!timeCard}" var="tim" id="theTimeTable" rowClasses="odd,even" align="left">

            <apex:column >
                &nbsp;
                &nbsp;
                <apex:facet name="header">&nbsp;&nbsp;&nbsp;Date</apex:facet>               
               <b> <apex:outputText value="{!tim.Date__c}  "/></b>
                &nbsp;
            </apex:column>
           
            <apex:column >
                &nbsp;
                &nbsp;
                <apex:facet name="header">&nbsp;&nbsp;&nbsp;Hours</apex:facet>               
               <b> <apex:outputText value="{!tim.Hours__c}  "/></b>
                &nbsp;
            </apex:column>
           
           
            <apex:column >
                &nbsp;
                &nbsp;
                <apex:facet name="header">&nbsp;&nbsp;&nbsp;Client</apex:facet>               
               <b> <apex:outputText value="{!tim.Client__r.Name}  "/></b>
                &nbsp;
            </apex:column>          
</apex:dataTable>
<apex:pageBlock >
<apex:outputField value="{!Contact.Signature__c}"/>
</apex:pageBlock>
</apex:page>

 

Controller:

public with sharing class TimeCardExtension{
   
    private final List<Time_Card__c> timeCard;
   
    public TimeCardExtension(ApexPages.StandardController controller) 
   
        {
        timeCard = [select id, Name, Therapist__c, Date__c, Hours__c, Client__c, Client__r.Name, Therapist__r.Start_Date__c, Start_Date__c, Therapist__r.End_Date__c, Therapist__r.Client__c, Client_Match__c,
        from Time_Card__c where Therapist__c=:ApexPages.currentPage().getParameters().get('id')
        Order By Client__r.Name];
        }
       
         public List<Time_Card__c> gettimeCard() {
            return timeCard;
      } 
   
    }