+ Start a Discussion
jsessford_rcijsessford_rci 

Multiple Levels of Nested Children / Wrapper Class

Hello.

 

Our project-management application has a structure as follows: A Project_Template object has multiple Task_Template objects, which has multiple Dependency_Template objects, which has multiple Dependency_Filter objects.

 

I am currently building a class that walks through the project template and populates a new project based on the existing template(s).

 

I would have liked to select everything at once in a single SOQL query (like below) so that I can easily iterate through it.

 

 

this.projectTemplate = [SELECT Id, (SELECT Id, (SELECT Id, (SELECT Id FROM Dependency_Filters__r) FROM Dependency_Templates__r) FROM Task_Templates__r) FROM Project_Template__c WHERE Id = :ProjectTemplateId];

 

But of course, this is giving me the "SOQL statements cannot query aggregate relationships more than 1 level away from the root entity object." error.

 

So, my next thought was to write a wrapper class that queries each object as needed, that I could still iterate through. This task is proving more complex than I bargained for, and I am looking for an easier way to handle this entire process.

 

I can't imagine I'm the only one to have this issue. Is there anyone who could point me in the right direction, maybe some code samples?

 

Thanks in advance.

 

Arvind1Arvind1

Hi,

 

Refer this link something similar he is trying to do.

 

http://community.salesforce.com/t5/Visualforce-Development/Problem-with-Repeat-Tag-Urgent/m-p/122640

 

Thanks

Arvind