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
Sarah LinkenhokerSarah Linkenhoker 

How do I filter opportunity product results on a visual force page?

<apex:page standardController="Opportunity"  renderAs="pdf">

 
  <h1>Packing Slip</h1>
  
  <p></p>
  <h2>Ship To</h2>
     <p><b><apex:outputText value="{!Opportunity.Account.Name}"/></b>
     <br><apex:outputText value="{!Opportunity.ia_crm__Ship_to__r.FirstName}"/><apex:outputText value=" {!Opportunity.ia_crm__Ship_to__r.LastName}"/></br>
      <br><apex:outputText value="{!Opportunity.ia_crm__Ship_to__r.MailingStreet}"/></br>
      <br><apex:outputText value="{!Opportunity.ia_crm__Ship_to__r.MailingCity}"/><apex:outputText value=", {!Opportunity.ia_crm__Ship_to__r.MailingState}"/><apex:outputText value=" {!Opportunity.ia_crm__Ship_to__r.MailingPostalCode}"/></br>
      </p> 
     
    <p>PO #:<b><apex:outputText value=" {!Opportunity.Name}"/></b>
    <br>Order Date: <apex:outputText value=" {!Opportunity.CloseDate}"/></br>
    <br>Ship Date: <apex:outputText value=" {!TODAY()}"/></br></p>

<p></p>
<p></p>
<p></p>
<p></p>


<apex:pageBlock id="products_list">


      <apex:pageblockSection title="Shipment Details" columns="3">
      
          <apex:pageBlockTable value="{!opportunity.opportunityLineItems}"  var="prd" width="600px">

              <apex:column headerValue="Product" value="{!prd.ProductCode}"/>
              <apex:column headerValue="Description" value="{!prd.Product2.Name}"/>
              <apex:column headerValue="Quantity" value="{!prd.Quantity}"/>

        </apex:pageBlockTable>
    </apex:pageblockSection>
</apex:pageBlock>


</apex:page>

I have the Visualforce page above, which allows me to create a packing slip that can be printed out for some of our opportunities. However, we want the list of Opp Products to be limited to inventory only, and we want to filter out the non-inventor items from this view. 
How can I filter the apex:pageBlockTable to only include specific items?
Dhanya NDhanya N
Hi Sarah,

If you have any field on Opp product to filter them then you can use rendered attribute on apex:cloumn and use filter condition. Something like this:  rendered="{!prd.isInventory__c==true}"

Thanks,
Dhanya