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
Edwards71Edwards71 

Visualforce page not showing data from one query in controller extension

Hi,

 

I have a custom object (contract_review__c) for which I have created a visualforce page. It uses contract_review__c as a standard controller with a custom controller extension (findings).  I'm using PageBlockTable referencing the custom controller extension to iterate over data. 

 

The first three classes of the attached code work fine (note that the related_findings__c object is a related table to Contract_review__c and Contract is the standard object.

 

The last class does not show any records on the visualforce page, even though in debug I can see it has found 12 rows which is the correct number. I've hard coded an account Id for the minute to eliminate that as an issue.

 

Any ideas? Thanks in advance

Controller Extension

public class Findings {

    

    public Findings(ApexPages.StandardController controller) {
    
       }
   
    Public Review_findings__c [] getKeyfindings () {
        return [Select Name,Review_area__c,Status__c,What_was_the_finding__c,type__c,What_is_the_financial_Impact__c,related_to_review__c
        FROM Review_Findings__c where related_to_review__c = :System.currentPageReference().getParameters().get('id') 
        and include_in_executive_summary__c='Yes' order by Name ASC];
        
        }
        
     Public Review_findings__c [] getFailedfindings () {
        return [Select Name,Review_area__c,Status__c,What_was_the_finding__c,type__c,What_is_the_financial_Impact__c,related_to_review__c
        FROM Review_Findings__c where related_to_review__c = :System.currentPageReference().getParameters().get('id') 
        and Status__c='Failed'order by Name ASC];
        
        }
           
       Public Review_findings__c [] getPassedfindings () {
        return [Select Name,Review_area__c,Status__c,What_was_the_finding__c,type__c,What_is_the_financial_Impact__c,related_to_review__c
        FROM Review_Findings__c where related_to_review__c = :System.currentPageReference().getParameters().get('id') 
        and Status__c!='Failed'order by Name ASC];
        
        }
        
        Public Contract [] getContractListing() {       
        return [Select AccountId,Agreement_type__c,StartDate,EndDate,ContractNumber
        FROM Contract where AccountID ='001Z0000003sLj4'];
        
        }  
      }

VF Page code for getContractlisting

<apex:page standardcontroller="Contract_Review__c" showheader="false" contenttype="application/pdf"  extensions="Findings" renderas="pdf"  cache="true">

<apex:pageblock >
 <apex:pageBlockTable value="{!Contractlisting}" var="cl" cellpadding="10" rules="all" styleclass="pageblock" >
    <apex:outputField value="{!cl.StartDate}" />
    <apex:outputField value="{!cl.EndDate}" />
      </apex:pageblockTable>
      </apex:pageblock>

 

Best Answer chosen by Admin (Salesforce Developers) 
Baktash H.Baktash H.

Try to use <apex:column> in the pageblocktable to see the values of your query.

 

 <apex:pageBlockTable value="{!Contractlisting}" var="cl" cellpadding="10" rules="all" styleclass="pageblock" >
    <apex:column value="{!cl.StartDate}" />
    <apex:column value="{!cl.EndDate}" />
 </apex:pageblockTable>