+ Start a Discussion
Adam RycroftAdam Rycroft 

add two filter variables to an apex repeat

Hi, I've got the first half of this working correctly. I want only records in the apex:repeat where a number field (age__c) is over 17. I also want only records where a picklist field (status__c) value is 'current.' I'm stumped how to add this second filter onto the records.

How do I write this with two filters on the apex repeat? 
<apex:page standardController="Account" tabStyle="Account" docType="html" renderas="pdf">
<apex:styleSheet value="{!URLFOR($Resource.AHHClientReportingCSS)}" />
                <td style="width:245px;height:85px;">
                    <apex:image url="/resource/SPHousing" width="100%"/>                    
                <td style="font-weight:bold;font-size:22px;text-align:center;">
                    3-DAY NOTICE TO PAY RENT OR MOVE OUT
    <div class="outerSpace">
    <td style="font-weight:bold;font-size:16px;text-align:left;">
    Plaintiff(s): SP Housing Resources<br></br>
    <div style="float: left; width: 50%;">  
    <apex:repeat value="{!Account.Households__r}" var="house">
    <apex:outputPanel rendered="{!house.Age__c > 17}">
        <apex:outputField value="{!house.Household_Member__c}"/>, Resident<br></br>
     <div style="float: right; width: 50%;">
      <td style="font-weight:bold;font-size:18px;text-align:center;">
      Notice to Pay Rent or Quit
Deepali KulshresthaDeepali Kulshrestha
Hi Adam,

You can use if condition in VF page to filter out the records

Please refer to my example below :

<apex:outputLink value="/page" styleClass="btn" id="register" rendered="{!IF(AND(Category__c == 'data1',article.Custom_URL == ''), TRUE, FALSE)}">Register</apex:outputLink>

You can use multiple conditions in one if.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too

Thanks and Regards,
Deepali Kulshrestha