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
TechnossusTechnossus 

Qury to fetch the records in master detail relation

Hi all,

 

I have one master- Child relation between two objects Case_Accession (Master) , Apcase(Child). Now I want to access the different fileds in one object only of Case_Accession so that I can show it on VF page in the form of Data Table. But I am getting  error "Error: Could not resolve field 'CaseNo__c' from <apex:outputField> value binding '{!wrklst.CaseNo__c}' in page WorkList". 

 

My Code is this

 

public class Worklist
{
    public List<Case_Accession__c> objWorklist {get;set;}
   
    public Worklist()
    {
        objWorkList = new List<Case_Accession__c>();
        objWorkList = [Select PatientName__c,PhysicianName__c ,(select CaseNo__c from ApCase__r) from Case_Accession__c];
    }

 

Visual Foce

 

<apex:page controller="Worklist">
     <apex:Form >
     <apex:pageBlock >
             <apex:pageblockSection >
                 <apex:dataTable id="dtWorklist" value="{!objWorklist }" var="wrklst"  cellspacing="16%">
                  <apex:column headerValue="Patient Name" >
                   <apex:outputField value="{!wrklst.PatientName__c}" />
                   </apex:column>
                   <apex:column headerValue="Physician Name" >
                   <apex:outputField value="{!wrklst.PhysicianName__c}" />
                   </apex:column>
                 <apex:column headerValue="Physician Name" >
                   <apex:outputField value="{!wrklst.CaseNo__c}" />
                   </apex:column>
                   <apex:column headerValue="Edit Case">
                   <apex:commandLink title="Edit" value="Edit"/>
                   </apex:column>
                 </apex:dataTable>
         </apex:pageblockSection>
     </apex:pageBlock>
     </apex:Form>
</apex:page>

 

Please help, Thanks in advance
   
}

souvik9086souvik9086

Modify like this

 

<apex:dataTable id="dtWorklist" value="{!objWorklist }" var="wrklst" cellspacing="16%">
<apex:column headerValue="Patient Name" >
<apex:outputField value="{!wrklst.PatientName__c}" />
</apex:column>
<apex:column headerValue="Physician Name" >
<apex:outputField value="{!wrklst.PhysicianName__c}" />
</apex:column>
<apex:column headerValue="Physician Name" >
<apex:dataTable id="apcase" value="{!wrklst.ApCase__r}" var="apcase" cellspacing="16%">

<apex:column headerValue="">

<apex:outputField value="{!apcase.CaseNo__c}" />

</apex:column>
</apex:dataTable>
</apex:column>
<apex:column headerValue="Edit Case">
<apex:commandLink title="Edit" value="Edit"/>
</apex:column>
</apex:dataTable>

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

AKS018AKS018
Better to use Wrapper class. Collect all data from Different objects. Then display in a table.