You need to sign in to do that
Don't have an account?
Self Join in SoQL
Hi,
I am new developer to Salesforce.. I have a custom object of 'Value' having the following feilds,
Name(Primary Key)
VSDesc__c(Description)
Parent_Value__c(Parent Value)
Child_Parent_Value__r(Look up)
now i want to have nested table in which each Parent should display its childs as shown here:
http://www.forcetree.com/2010/04/nested-tables-and-nested-queries-in.html
I have made the controller as :
//Control Class
public class ValueManager
{
public List<Seg1__c> getValue()
{
List<Seg1__c> Values = [Select Name, (Select Name, VSDesc__c From Child_Parent_Value__r where Parent_Value__c <> null) From Seg1__c p where p.Parent_Value__c= null] ;
return Values;
}
}
//Visual Page
<apex:page controller="ValueManager" showheader="false">
<apex:pageblock >
<apex:pageblocktable value="{!Value}" var="par">
<apex:column headervalue="Parent Value">
<apex:outputtext value="{!par.Name}"/>
</apex:column>
<apex:pageblocktable value="{!Value}" var="ch">
<apex:column headervalue="Description">
<apex:outputtext value="{!ch.Name}"/>
</apex:column>
</apex:pageblocktable>
</apex:pageblocktable>
</apex:pageblock>
</apex:page>
Can any one help me how can i acheive???
Replace your second (nested) <apex:pageBlockTable>...</apex:pageBlockTable> code with the following code:
Hope this helps.
Thanks.