• ars
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies

APEX CLASSES

 

public List<cCampaign> getcCampaign(){       

    Campaign[] campParent = [Select Id, Name from Campaign where id = :c.Id];       

   

        ParentCmembers =  [Select Contact.Id from CampaignMember where Campaignid = :campParent[0].id];              

        for (CampaignMember cm : ParentCmembers){

            ParentMemberIds.add(cm.Contact.Id);

        }

 

        cCampaign x = new cCampaign(campParent[0],ParentMemberIds);

        lCampaign.add(x);                    

       

       

        CmParent.add(campParent[0].Id);

        CmParentName.add(campParent[0].Name);

        TotalCampaignIds.add(campParent[0].Id);

       

        return lCampaign;   

}

 

public List<cCampaign> getChildcampaign(){

 

    Campaign[] campChild = [Select Id ,Name from Campaign where Parent_Campaign_Name__c like: CmParentName];

 

    if (campChild .size() > 0){

           

        for (integer i = 0; i < campChild.size();i++){

            sCampaignIds.add(campChild[i].Id);

            TotalCampaignIds.add(campChild[i].Id);

            sCmChildlv3.add(campChild[i].Name);

        }

           

        ChildCmembers  =  [Select Id,Contact.Id,Campaignid from CampaignMember where Campaignid in :sCampaignIds];              

       

        for (integer i = 0; i < ChildCmembers.size();i++){

              sContactid.add(ChildCmembers[i].Contact.Id);

        }

        

        for (integer i = 0; i < campChild.size();i++){

            cCampaign childCampaign = new cCampaign(campChild[i],sContactid);

            lChildCampaign.add(childCampaign);     

        }           

       

        return lChildCampaign;

    }

    else{

        return null;

    }   

}

 

public List<cCampaign> getChildLvl3(){

 

    Campaign[] campChild3 = [Select Id ,Name from Campaign where Parent_Campaign_Name__c In: sCmChildlv3];

    sCampaignIds.clear();

    if (campChild3.size() > 0){

           

        for (integer i = 0; i < campChild3.size();i++){

            sCampaignIds.add(campChild3[i].Id);

            TotalCampaignIds.add(campChild3[i].Id);

            sCmChildlv4.add(campChild3[i].Name);

        }

           

        ChildCmembers  =  [Select Id,Contact.Id,Campaignid from CampaignMember where Campaignid in :sCampaignIds];              

       

        for (integer i = 0; i < ChildCmembers.size();i++){

              sContactid.add(ChildCmembers[i].Contact.Id);

        }

        for (integer i = 0; i < campChild3.size();i++){

            cCampaign childCampaign = new cCampaign(campChild3[i],sContactid);

            lChildCampaign3.add(childCampaign);     

        }           

       

        return lChildCampaign3;

    }

    else{

        return null;

    }   

}

 

=============================================================================

PAGES 

 

        <apex:repeat value="{!cCampaign}" var="ch" rendered="{!NOT(ISNULL(cCampaign))}">

            <tr>       

                <td colspan="5" HeaderValue="Campaign Name" style="width:40%">

                    <apex:outputLink title="" value="/{!ch.Cmp.Id}">

                    <apex:outputText value="{!ch.Cmp.Name}"/>

                    </apex:outputLink>

                </td>

                <td style="width:15%">{!ch.fedCount}</td>

                <td style="width:15%">{!ch.fedResponse}</td>

                <td style="width:15%">{!ch.NonfedCount}</td>

                <td style="width:15%">{!ch.NonfedResponse}</td>                                                                

            </tr>      

           

            <apex:repeat value="{!ChildCampaign}" var="c2" rendered="{!NOT(ISNULL(cCampaign))}" >

                <tr>

                    <td width="25px"></td>

                    <td colspan="4" style="width:40%">

                        <apex:outputLink title="" value="/{!c2.Cmp.Id}">

                        <apex:outputText value="{!c2.Cmp.Name}"/>

                        </apex:outputLink>

                    </td>

                    <td style="width:15%">{!c2.fedCount}</td>

                    <td style="width:15%">{!c2.fedResponse}</td>

                    <td style="width:15%">{!c2.NonfedCount}</td>

                    <td style="width:15%">{!c2.NonfedResponse}</td>                                                                 

                </tr>          

               

                <apex:repeat value="{!ChildLvl3}" var="c3" rendered="{!NOT(ISNULL(cCampaign))}" >

                    <tr>

                        <td width="25px"></td>

                        <td width="25px"></td>       

                        <td colspan="3" style="width:40%">

                            <apex:outputLink title="" value="/{!c3.Cmp.Id}">

                            <apex:outputText value="{!c3.Cmp.Name}"/>

                            </apex:outputLink>

                        </td>

                        <td style="width:15%">{!c3.fedCount}</td>

                        <td style="width:15%">{!c3.fedResponse}</td>

                        <td style="width:15%">{!c3.NonfedCount}</td>

                        <td style="width:15%">{!c3.NonfedResponse}</td>

                    </tr>

                </apex:repeat>

            </apex:repeat>

        </apex:repeat>

 

 

================================================

Question:

We are creating the Custom Campaign Hierarchy...

Based from the CLASS created, how can we bind the repeat value up to Five (5) levels in the hierarchy?
 
Sample (something like this)...

Campaign Itself

                Child 1 Campaign

                                Child Child Campaign

                                                Child Child Child Campaign

                                                                Child Child Child Child Campaign

                Child 2 Campaign

 
 
This is getting me crazy :( and Thanks in advance ^_^