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
ElJefeElJefe 

Filtering data

See page block below.  I need to filter data returned based on Billing_Status__c value.  What is the best way to accomplish? 

Regards,

Jeff

 

  <apex:pageBlock title="Services" >
        <apex:pageBlockTable value="{!Projects__c.Time_Sheets__r}" var="item" border="1" width="100%">
            <apex:column value="{!item.Billing_Status__c}"/> 
            <apex:column value="{!item.Project_Task__r.Start_Date__c}"/> 
            <apex:column value="{!item.Project_Task__r.End_Date__c}"/>
            <apex:column value="{!item.Project_Task_Resource__c}"/> 
            <apex:column value="{!item.Project_Task__c}" /> 
            <apex:column value="{!item.Project_Task_Billing_Rate__c}"/> 
            <apex:column value="{!item.Total_Line_Hours__c}"/> 
            <apex:column value="{!item.Total_Line_Amount__c}"/>        
        </apex:pageBlockTable> 
  </apex:pageBlock>
bob_buzzardbob_buzzard

Can you be a little more specific?  Presumably by filter you mean exclude/include displayed information?  

ElJefeElJefe

Specifically I want to include all values where Billing_Status__c = "Billed" on this page/report, excluding all other Billing_Status__c values.

bob_buzzardbob_buzzard

I'm tempted to say use the rendered attribute on the column, but I'm not sure if that is evaluated each time through the loop or if it would be picked up first time through and thus display everything or nothing.  Might be worth a try though, e.g.

 

<apex:pageBlock title="Services" >
        <apex:pageBlockTable value="{!Projects__c.Time_Sheets__r}" var="item" border="1" width="100%">
            <apex:column value="{!item.Billing_Status__c}" rendered="{!item.Billing_Status__c=='Billed'}/> 
          etc
        </apex:pageBlockTable> 
  </apex:pageBlock>
bob_buzzardbob_buzzard

If that doesn't do it, you might want to consider using a vanilla HTML table combined with an apex:repeat tag.  That way you could wrap the table row in an apex:outputpanel and only render that if the status matched.

ElJefeElJefe

Will give 'em a go this evening and post reply on results; thanks Bob.