I am trying to figure out how to test fields (included within a apex:repeat) to see if they are blank, or null, and if so display some alternate text (Ex: No records to display) in the table instead of a blank table. Existing code snippet below:

```
<apex:repeat var="auditList" value="{!relatedTo.Site_Audit__r}">
   <tr>
    <td>
    <apex:outputField value="{!auditList.Audit_Type__c}" />
    </td>
    <td>
        <apex:outputField value="{!auditList.Delivery_Date__c}" />
    </td>
    <td>
    <apex:outputField value="{!auditList.Review_Date__c}" />
    </td>
   </tr>
</apex:repeat>

```

So in pseudo code I am looking for a test such as:

```
IF RELATED RECORDS FOUND FOR APEX:REPEAT PERFORM FOLLOWING:

<apex:repeat var="auditList" value="{!relatedTo.Site_Audit__r}">
   <tr>
    <td>
    <apex:outputField value="{!auditList.Audit_Type__c}" />
    </td>
    <td>
        <apex:outputField value="{!auditList.Delivery_Date__c}" />
    </td>
    <td>
    <apex:outputField value="{!auditList.Review_Date__c}" />
    </td>
   </tr>
</apex:repeat>

ELSE IF NO RELATED RECORDS PERFORM FOLLOWING:

<tr>
    <td>
    No records to display.

    </td>
</tr>

```

Thanks in advance for the help!

---

**Update in response to first answer from 'eyescream'**

---

Gave the apex:pageBlock method a shot, but ran into the following error when trying to save/deploy:

Result: FAILED Problem: `<messaging:emailTemplate> cannot contain <apex:pageBlock>.`
------------------------------------------------------------------------------------

Now this is a email template that produces an attached PDF (see general outline of the code below). So is that the case...pageBlock is not allowed within a email template? Thanks for the help!

```
<messaging:emailTemplate subject="Your requested quote #{!relatedTo.Name}" 
recipientType="Contact"
relatedToType="X360_Contract_Cycle__c">

<messaging:plainTextEmailBody >
.
.
.
</messaging:plainTextEmailBody>

<messaging:attachment renderAs="pdf" filename="{!relatedTo.name}">
.
.
.
<apex:pageBlock rendered="{!AND(NOT(ISNULL(auditList)),auditList.size>0)}">

    <apex:repeat var="auditList" value="{!relatedTo.Site_Audit__r}">
       <tr>
        <td>
            <apex:outputField value="{!auditList.Audit_Type__c}" />
        </td>
        <td>
            <apex:outputField value="{!auditList.Delivery_Date__c}" />
        </td>
        <td>
            <apex:outputField value="{!auditList.Review_Date__c}" />
        </td>
       </tr>
   </apex:repeat>

</apex:pageBlock>

<apex:pageBlock rendered="{!OR(ISNULL(auditList),auditList.size=0)}">
    <i>No records to display.</i>
</apex:pageBlock>
.
.
.
</messaging:attachment>
</messaging:emailTemplate>

```