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
ksalesforceksalesforce 

Visualforce page not showing data

The eblow code does not display the data. What could be the problem?

 

VF Page

 

<apex:page standardController="opportunity" extensions="wbsextension">
<apex:form >
<apex:pageBlock title="WBS Element">

<apex:pageBlockSection title="WBS Element Details" columns="3">

<apex:pageBlockTable value="{!obj1}" var="a" cellpadding="10" rules="all" styleclass="pageblock" >>
<apex:column value="{!a.pse__Opportunity__r.Opportunity_Number__c}"/>
<apex:column value="{!a.pse__Project_Manager__c}"/>
<apex:column value="{!a.pse__Start_Date__c}"/>

</apex:pageBlockTable>
</apex:pageBlocksection>


<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Extension:

 

public class wbsextension {

public wbsextension(ApexPages.StandardController controller) {


}


public pse__Proj__c[] getobj1(){

 

return [SELECT pse__Opportunity__r.id,pse__Opportunity__r.Opportunity_Number__c,pse__Project_Manager__c,pse__Start_Date__c FROM pse__Proj__c WHERE pse__Opportunity__r.id='vp006c0000008iP'];

 

}
}

mauro_offermannmauro_offermann

If you change your query for:

	public pse__Proj__c[] getobj1(){
		return [SELECT pse__Opportunity__r.id,pse__Opportunity__r.Opportunity_Number__c,pse__Project_Manager__c,pse__Start_Date__c FROM pse__Proj__c LIMIT 10];
	}

 

shows something?

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi,

 

Include the highlighted lines and try the following in your extension,

 

Extension:

public class wbsextension {

List<pse__Proj__c> obj1 = new List<pse__Proj__c>();   //Declare and initialize the list here

public wbsextension(ApexPages.StandardController controller) { }


public List<pse__Proj__c> getobj1(){

//Select the query of list of records in that initialized list instance     

obj1 = [SELECT pse__Opportunity__r.id,pse__Opportunity__r.Opportunity_Number__c,pse__Project_Manager__c,pse__Start_Date__c FROM pse__Proj__c WHERE pse__Opportunity__r.id='vp006c0000008iP'];

return obj1;

}
}

 

Hope so this helps you...!

Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.

ksalesforceksalesforce
Hi,

I just tried like this and it worked. thanks all.


public class wbsextension {

public wbsextension(ApexPages.StandardController controller) {


}


public pse__Proj__c[] getobj1(){



return [SELECT
pse__Opportunity__r.id,pse__Opportunity__r.Opportunity_Number__c,pse__Opportunity__r.LX_SoldToID__c,pse__Opportunity__r.LX_Opportunity_Division__c,pse__Project_Manager__c,pse__Start_Date__c,pse__End_Date__c,Project_Category__c,
Description_Comments__c FROM pse__Proj__c WHERE
pse__Opportunity__r.id=:System.currentPageReference()
.getParameters().get('id')];




}
}