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
Graham Booth 11Graham Booth 11 

Apex page with Parent & Child links

I am new to apex development and am struggling outputting data from the Parent and Child objects in a PDF format.  I have completed the output of data from the Parent Account and the related lists, but would like to be able to control the fields which appear from the child objects.

Below is the code that I have created.  The lines in Bold is where i am getting stuck.  The Related list code does work, but just dumps everythin from the related list.  The other bold line is not working an I cannot figure out why it cannot refernce the child object.

Any help would be appreciated.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<apex:page standardController="Patient__c" renderAs="pdf">

    <apex:stylesheet value="{!$Resource.pdfStyle}"/>
    <center>
        <h1>COMPANY Patient Form</h1>
    </center>

    <table align="center" style="border: 1px solid #6699CC;">
        <tr>
            <td style="background-color: #6699CC; color: #FFFFFF; font-size: 100%; padding: 10px;">Patient Details</td>
        </tr>
        
    <pre></pre>
    <tr>
        <apex:form >
            <apex:pageBlock >
                <apex:panelgrid columns="1">
                    <apex:OutputText value="Name: {!Patient__c.First_Name_s__c} {!Patient__c.Family_Name__c}"/>
                    <apex:OutputText value="Date Of Birth: {!Patient__c.Date_Of_Birth__c}"/>
                    <apex:OutputText value="Gender: {!Patient__c.Gender__c}"/>
                </apex:panelgrid>
            </apex:pageBlock>
        </apex:form>
    </tr>
    </table>

    <table align="center" style="border: 1px solid #6699CC;">
        <tr>
            <td style="background-color: #6699CC; color: #FFFFFF; font-size: 100%; padding: 10px;">Weighing Details</td>
        </tr>    
    <pre></pre>
    <apex:relatedList list="Patient_Weights__r" />
    <tr>
        <apex:form >
            <apex:pageBlock >
                <apex:pageBlockSection columns="1">
                    <apex:OutputField value="{!Patient_Weights__r.Name}"/>
                </apex:pageBlockSection>
            </apex:pageBlock>
        </apex:form>
    </tr>
    </table>
    
</apex:page>