+ Start a Discussion
Andrew AldisAndrew Aldis 

How can I select records for my pageblocktable

I  am working on a vf page that I would like and have a related list that I would like to only show records with a specific shipment type.  Basically I would liek the second pageblocktable to only show records where the shimpment_Type__c ="Drop Ship". 

<apex:page standardController="SFDC_Project__c">
    <style type="text/css">
        #head {font-size:25pt;}
    </style>
    <center>
        <h1 id="head">
        Installation Shipping Information
        </h1>
    </center>
    <apex:pageBlock title="Installation Details">
    <apex:pageBlockSection>
        <apex:outputField value="{! SFDC_Project__c.Name }"/>
        <apex:outputField value="{! SFDC_Project__c.Account__c }"/>
        <apex:outputField value="{! SFDC_Project__c.SFDC_Project_Name__c }"/>
        <apex:outputField value="{! SFDC_Project__c.SFDC_Project_Manager__c}"/>
    </apex:pageBlockSection>
        <h1 id="t1head">
            Hardware Shipping Information
        </h1>
    <apex:pageBlockTable value="{!SFDC_Project__c.Hardware_Information__r}" var="hardware">
      <apex:column value="{!hardware.Shipment_Type__c}"/>
      <apex:column value="{!hardware.Ship_Date__c}"/>
      <apex:column value="{!hardware.Item_Master__c}"/>
      <apex:column value="{!hardware.Sales_Order__c}"/>
      <apex:column value="{!hardware.Sales_Order_Line_Item__c}"/>
      <apex:column value="{!hardware.Name}"/>
      <apex:column value="{!hardware.Quantity_Ordered__c}"/>
      <apex:column value="{!hardware.Quantity_Shipped__c}"/>
      <apex:column value="{!hardware.Carrier_for_Shipment__c}"/>
      <apex:column value="{!hardware.Tracking_Number__c}"/>
      <apex:column value="{!hardware.Ship_to_Address__c}"/>
   </apex:pageBlockTable>
        <h1 id="t2head" class="thead">
            Drop Shipped Serial Numbers
        </h1>
   <apex:pageBlockTable id="dropShipSN" value="{!SFDC_Project__c.Hardware_Information__r}" var="hardware">
      <apex:column value="{!hardware.Item_Master__c}"/>
      <apex:column value="{!hardware.Serial_Number_Shipped_from_Denver_Whs__c}"/>
      <apex:column value="{!hardware.Ship_Date__c}"/>
      <apex:column value="{!hardware.Ship_to_Address__c}"/>
       <apex:column value="{!hardware.Shipment_Type__c}"/>
   </apex:pageBlockTable>
</apex:pageBlock>
    

</apex:page>
 
Best Answer chosen by Andrew Aldis
Vivek DeshmaneVivek Deshmane
Hi,
Try below code and let me know if it works.
 
<apex:page standardController="SFDC_Project__c">
    <style type="text/css">
        #head {font-size:25pt;}
    </style>
    <center>
        <h1 id="head">
        Installation Shipping Information
        </h1>
    </center>
    <apex:pageBlock title="Installation Details">
    <apex:pageBlockSection>
        <apex:outputField value="{! SFDC_Project__c.Name }"/>
        <apex:outputField value="{! SFDC_Project__c.Account__c }"/>
        <apex:outputField value="{! SFDC_Project__c.SFDC_Project_Name__c }"/>
        <apex:outputField value="{! SFDC_Project__c.SFDC_Project_Manager__c}"/>
    </apex:pageBlockSection>
        <h1 id="t1head">
            Hardware Shipping Information
        </h1>
    <apex:pageBlockTable value="{!SFDC_Project__c.Hardware_Information__r}" var="hardware">
      <apex:column value="{!hardware.Shipment_Type__c}"/>
      <apex:column value="{!hardware.Ship_Date__c}"/>
      <apex:column value="{!hardware.Item_Master__c}"/>
      <apex:column value="{!hardware.Sales_Order__c}"/>
      <apex:column value="{!hardware.Sales_Order_Line_Item__c}"/>
      <apex:column value="{!hardware.Name}"/>
      <apex:column value="{!hardware.Quantity_Ordered__c}"/>
      <apex:column value="{!hardware.Quantity_Shipped__c}"/>
      <apex:column value="{!hardware.Carrier_for_Shipment__c}"/>
      <apex:column value="{!hardware.Tracking_Number__c}"/>
      <apex:column value="{!hardware.Ship_to_Address__c}"/>
   </apex:pageBlockTable>
        <h1 id="t2head" class="thead">
            Drop Shipped Serial Numbers
        </h1>
  <apex:pageBlockTable id="dropShipSN" value="{!SFDC_Project__c.Hardware_Information__r}" var="hardware">
      <apex:column value="{!hardware.Item_Master__c}" rendered="{!IF(hardware.shimpment_Type__c =='Drop Ship',true,false)}"/>
      <apex:column value="{!hardware.Serial_Number_Shipped_from_Denver_Whs__c}" rendered="{!IF(hardware.shimpment_Type__c =='Drop Ship',true,false)}"/>
      <apex:column value="{!hardware.Ship_Date__c}" rendered="{!IF(hardware.shimpment_Type__c =='Drop Ship',true,false)}"/>
      <apex:column value="{!hardware.Ship_to_Address__c}" rendered="{!IF(hardware.shimpment_Type__c =='Drop Ship',true,false)}"/>
       <apex:column value="{!hardware.Shipment_Type__c}" rendered="{!IF(hardware.shimpment_Type__c =='Drop Ship',true,false)}"/>
   </apex:pageBlockTable>
</apex:pageBlock>
    

</apex:page>

Best Regards,
-Vivek