
VF Page
Extension:<apex:page standardController="Account" showHeader="true" extensions="TestDisplayQueryResults">
<!-- Define Tab panel .css styles -->
<style>
.activeTab {background-color: ⌗236FBD; color:white; background-image:none}
.inactiveTab { background-color: lightgrey; color:black; background-image:none}
</style>
<!-- Create Tab panel -->
<apex:tabPanel switchType="client" selectedTab="name2" id="AccountTabPanel"
tabClass="activeTab" inactiveTabClass="inactiveTab">
<apex:tab label="Subscriptions" name="name1" id="tabOne">
<apex:relatedList list="Subscriptions__r"/>
</apex:tab>
<apex:tab label="PCS" name="name2" id="tabTwo">
<apex:pageBlock title="My Content">
<apex:pageBlockTable value="{!SubItems}" var="item">
<apex:column value="{!item.name}"/>
<apex:column value="{!item.id}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:tab>
</apex:tabPanel>
</apex:page>
public with sharing class TestDisplayQueryResults
{
public String currentRecordId {get;set;}
public Account acc{get;set;}
public List<Subscription__c> Subs{get; set;}
public List<Subscription_Item__c> SubItems{get; set;}
public TestDisplayQueryResults(ApexPages.StandardController controller)
{
currentRecordId = ApexPages.CurrentPage().getparameters().get('id');
acc = [select id ,name from Account where id =: currentRecordId ];
Subs = [select id, Name, (Select id, name, Product_Code_PCS_TSM__c from Subscription_Items__r where Product_Code_PCS_TSM__c = true) from Subscription__c where Account_ID__c = :acc.Id];
for(Subscription__c Subs : [select id, Name, (Select id, name, Product_Code_PCS_TSM__c from Subscription_Items__r where Product_Code_PCS_TSM__c = true) from Subscription__c where Account_ID__c= :acc.Id])
{
for(Subscription_Item__c items: Subs.Subscription_Items__r)
{
SubItems.add(items);
}
}
}
}
try this public with sharing class TestDisplayQueryResults
{
public String currentRecordId {get;set;}
public Account acc{get;set;}
public List<Subscription__c> Subs{get; set;}
public List<Subscription_Item__c> SubItems{get; set;}
public TestDisplayQueryResults(ApexPages.StandardController controller)
{
currentRecordId = ApexPages.CurrentPage().getparameters().get('id');
SubItems = new List<Subscription_Item__c>();
acc = [select id ,name from Account where id =: currentRecordId ];
Subs = [select id, Name, (Select id, name, Product_Code_PCS_TSM__c from Subscription_Items__r where Product_Code_PCS_TSM__c = true) from Subscription__c where Account_ID__c = :acc.Id];
for(Subscription__c Subs : [select id, Name, (Select id, name, Product_Code_PCS_TSM__c from Subscription_Items__r where Product_Code_PCS_TSM__c = true) from Subscription__c where Account_ID__c= :acc.Id])
{
for(Subscription_Item__c items: Subs.Subscription_Items__r)
{
SubItems.add(items);
}
}
}
}