フィールド(apex:repeat内に含まれる)をテストして、フィールドが空白かnullかを確認し、空白の代わりに代替テキスト(例:表示するレコードなし)をテーブルに表示する方法を理解しようとしています。テーブル。以下の既存のコードスニペット:
<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>
したがって、擬似コードでは、次のようなテストを探しています。
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>
助けてくれてありがとう!
'eyescream'からの最初の回答に応じて更新
apex:pageBlockメソッドを試してみましたが、保存/デプロイしようとすると次のエラーが発生しました。
結果:失敗問題:<messaging:emailTemplate> cannot contain <apex:pageBlock>.
これは、添付のPDFを生成する電子メールテンプレートです(以下のコードの一般的な概要を参照してください)。それで、ケース... pageBlockは電子メールテンプレート内で許可されていませんか?助けてくれてありがとう!
<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>