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
shachnashachna 

URGENT: How Do I Limit Records Rendered from a Related List onto a PDF?

I have a VF page that renders a PDF based off of a view. The trouble I'm having is I need to have it only render certain Records from the related list assciated with every reocrd. 

 

Code Sample: 

 

<apex:repeat var="cgs15" value="{!Clinical_Goals}">
<apex:actionRegion rendered="{!IF(AND(cgs15.Therapy_Type__c = 'Oral Motor Therapy', cgs15.RecordType.Name = 'Summary of Outcomes', cgs15.Status__c = 'Active'),True,False)}">
<div>
<h4>{!cgs15.RecordType.Name}</h4>
<p>{!cgs15.Description__c}</p></div>

<p></p><p></p>
</apex:actionRegion>
</apex:repeat>

<apex:repeat var="cg15" value="{!Clinical_Goals}">
<apex:actionRegion rendered="{!IF(AND(cg15.Therapy_Type__c= 'Oral Motor Therapy', cg15.RecordType.Name = 'Long Term Goal'),True,False)}">

<div><h4>Long Term Goal<br></br></h4>
<hr /><h4>
Status: <span class="plain"><u>{!cg15.Status__c}</u></span>
Start Date: <span class="plain"><apex:outputText value="{0,date,dd MMM yyyy}"><apex:param value="{!cg15.Goal_Start_Date__c}" /></apex:outputText></span>
End Date: <span class="plain"><apex:outputText value="{0,date,dd MMM yyyy}"><apex:param value="{!cg15.Goal_End_Date__c}" /></apex:outputText></span>
</h4>
<p>{!cg15.Description__c}</p></div>
<br></br>

<apex:repeat var="stg15" value="{!cg15.Short_Term_Goals__r}" >
<div> <h4>Short Term Goal <br />
Status:<span class="plain"> {!stg15.STG_Status__c}</span></h4>
<p>{!stg15.STG_Description__c}</p></div>
<br></br>
</apex:repeat>
</apex:actionRegion>
</apex:repeat>

Best Answer chosen by Admin (Salesforce Developers) 
Avidev9Avidev9

Use the rendered property to limit the records. You can do something like this

 

<apex:repeat var="stg15" value="{!cg15.Short_Term_Goals__r}" >
   <apex:outputPanel layout="block" rendered="{!stg15.Name == 'Test'}">
      <h4>Short Term Goal <br />
         Status:<span class="plain"> {!stg15.STG_Status__c}</span>
      </h4>
      <p>{!stg15.STG_Description__c}</p>
   </apex:outputPanel>
   <br></br>
</apex:repeat>

 In the above example all the Short term Goal which has name 'Test' will be rendered

 

 

All Answers

Avidev9Avidev9

Use the rendered property to limit the records. You can do something like this

 

<apex:repeat var="stg15" value="{!cg15.Short_Term_Goals__r}" >
   <apex:outputPanel layout="block" rendered="{!stg15.Name == 'Test'}">
      <h4>Short Term Goal <br />
         Status:<span class="plain"> {!stg15.STG_Status__c}</span>
      </h4>
      <p>{!stg15.STG_Description__c}</p>
   </apex:outputPanel>
   <br></br>
</apex:repeat>

 In the above example all the Short term Goal which has name 'Test' will be rendered

 

 

This was selected as the best answer
shachnashachna

Thank you. This solution worked perfectly.