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
harshasfdcharshasfdc 

soql query not returning a value in vf page

Hi All,

 

iam trying to retrive the data from 2 sobjects using soql qury and trying to show in vf page but the records in child object are displayed here is the apex code 

 

public class veepage2
{
public string ss{get;set;}
list<Physician__c>ph=new list<Physician__C>();

public list<Physician__c>getme()
{
ph=[select id,LastName__c,FirstName__c , PhysicianProd__r.PatientsOT3Mon__c,PhysicianProd__r.DCs12WeeksInd__c,PhysicianProd__r.LowConversionRateInd__c,PhysicianProd__r.NonTitratedPatientsInd__c,PhysicianProd__r.PotentialSwitchesInd__c,PhysicianProd__r.HighDCsDeathAEInd__C,PhysicianProd__r.Week8WriteInd__c,PhysicianProd__r.Week12ClaimsInd__c from Physician__C where PhysicianId__c='9900000300336'];
return p;
}
}

********************************************

<apex:page controller="veepage2" >
<apex:form >
<apex:pageBlock >
<apex:pageblocktable value="{!me}" var="m">

<apex:column value="{!m.LastName__c}"/>
<apex:column value="{!m.FirstName__c}"/>
<apex:column value="{!m.PhysicianProd__r.PatientsOT3Mon__c}"/>
<apex:column value="{!m.PhysicianProd__r.DCs12WeeksInd__c }"/>
<apex:column value="{!m.physicianprod__r.LowConversionRateInd__c}"/>
<apex:column value="{!m.physicianprod__r.NonTitratedPatientsInd__c}"/>
<apex:column value="{!m.physicianprod__r.NonTitratedPatientsInd__c}"/>
<apex:column value="{!m.physicianprod__r.PotentialSwitchesInd__c}"/>
<apex:column value="{!m.PhysicianProd__r.HighDCsDeathAEInd__c}"/>
<apex:column value="{!m.PhysicianProd__r.Week8WriteInd__c}"/>
<apex:column value="{!m.PhysicianProd__r.Week12ClaimsInd__c}"/>
</apex:pageblocktable>
</apex:pageBlock>
</apex:form>
</apex:page>

Best Answer chosen by Admin (Salesforce Developers) 
Naidu PothiniNaidu Pothini
Class:

public class veepage2
{
	public string ss{get;set;}
	public List<Physician__c> phyList { get; set; }
	
	public void autoRun()
	{
			phyList = new List<Physician__c>();
			
			phyList = [SELECT Id, LastName__c, FirstName__c, PhysicianProd__r.PatientsOT3Mon__c, PhysicianProd__r.DCs12WeeksInd__c,      PhysicianProd__r.LowConversionRateInd__c, PhysicianProd__r.NonTitratedPatientsInd__c,   PhysicianProd__r.PotentialSwitchesInd__c, PhysicianProd__r.HighDCsDeathAEInd__c,
					  PhysicianProd__r.Week8WriteInd__c, PhysicianProd__r.Week12ClaimsInd__c 
				   FROM Physician__c
				   WHERE PhysicianId__c ='9900000300336'];
	}
}

 

Page:

<apex:page controller="veepage2" action="{!autoRun}">
	<apex:form >
		<apex:pageBlock >
			<apex:pageblocktable value="{!phyList}" var="m">

				<apex:column value="{!m.LastName__c}"/>
				<apex:column value="{!m.FirstName__c}"/>
				<apex:column value="{!m.PhysicianProd__r.PatientsOT3Mon__c}"/>
				<apex:column value="{!m.PhysicianProd__r.DCs12WeeksInd__c }"/>
				<apex:column value="{!m.physicianprod__r.LowConversionRateInd__c}"/>
				<apex:column value="{!m.physicianprod__r.NonTitratedPatientsInd__c}"/>
				<apex:column value="{!m.physicianprod__r.NonTitratedPatientsInd__c}"/>
				<apex:column value="{!m.physicianprod__r.PotentialSwitchesInd__c}"/>
				<apex:column value="{!m.PhysicianProd__r.HighDCsDeathAEInd__c}"/>
				<apex:column value="{!m.PhysicianProd__r.Week8WriteInd__c}"/>
				<apex:column value="{!m.PhysicianProd__r.Week12ClaimsInd__c}"/>
				
			</apex:pageblocktable>
		</apex:pageBlock>
	</apex:form>
</apex:page>

 Try this.

All Answers

Naidu PothiniNaidu Pothini
Class:

public class veepage2
{
	public string ss{get;set;}
	public List<Physician__c> phyList { get; set; }
	
	public void autoRun()
	{
			phyList = new List<Physician__c>();
			
			phyList = [SELECT Id, LastName__c, FirstName__c, PhysicianProd__r.PatientsOT3Mon__c, PhysicianProd__r.DCs12WeeksInd__c,      PhysicianProd__r.LowConversionRateInd__c, PhysicianProd__r.NonTitratedPatientsInd__c,   PhysicianProd__r.PotentialSwitchesInd__c, PhysicianProd__r.HighDCsDeathAEInd__c,
					  PhysicianProd__r.Week8WriteInd__c, PhysicianProd__r.Week12ClaimsInd__c 
				   FROM Physician__c
				   WHERE PhysicianId__c ='9900000300336'];
	}
}

 

Page:

<apex:page controller="veepage2" action="{!autoRun}">
	<apex:form >
		<apex:pageBlock >
			<apex:pageblocktable value="{!phyList}" var="m">

				<apex:column value="{!m.LastName__c}"/>
				<apex:column value="{!m.FirstName__c}"/>
				<apex:column value="{!m.PhysicianProd__r.PatientsOT3Mon__c}"/>
				<apex:column value="{!m.PhysicianProd__r.DCs12WeeksInd__c }"/>
				<apex:column value="{!m.physicianprod__r.LowConversionRateInd__c}"/>
				<apex:column value="{!m.physicianprod__r.NonTitratedPatientsInd__c}"/>
				<apex:column value="{!m.physicianprod__r.NonTitratedPatientsInd__c}"/>
				<apex:column value="{!m.physicianprod__r.PotentialSwitchesInd__c}"/>
				<apex:column value="{!m.PhysicianProd__r.HighDCsDeathAEInd__c}"/>
				<apex:column value="{!m.PhysicianProd__r.Week8WriteInd__c}"/>
				<apex:column value="{!m.PhysicianProd__r.Week12ClaimsInd__c}"/>
				
			</apex:pageblocktable>
		</apex:pageBlock>
	</apex:form>
</apex:page>

 Try this.

This was selected as the best answer
Tejpal KumawatTejpal Kumawat

Try this one controller : ---

 

public class veepage2
{
public string ss{get;set;}
list<Physician__c>ph{get;set;}

public void me()
{

ph = new list<Physician__c>();
ph=[select id,LastName__c,FirstName__c , PhysicianProd__r.PatientsOT3Mon__c,PhysicianProd__r.DCs12WeeksInd__c,PhysicianProd__r.LowConversionRateInd__c,PhysicianProd__r.NonTitratedPatientsInd__c,PhysicianProd__r.PotentialSwitchesInd__c,PhysicianProd__r.HighDCsDeathAEInd__C,PhysicianProd__r.Week8WriteInd__c,PhysicianProd__r.Week12ClaimsInd__c from Physician__C where PhysicianId__c='9900000300336'];
}
}

 

 

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

harshasfdcharshasfdc

Hi naidu,

 

Thanks for the reply .it helped me a lot

 

Thanks,

Harsha