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
kiwitrotterkiwitrotter 

Question on how to display SOQL sub query results in result set for export.

Hi guys,

 

My question is more related to SOQL querying via a query editor rather than using SOQL in Apex.

 

Below is my query and when I run this query through a query editor such as Force.com explore or Real Force Explore the result set that comes back displays the record count for the sub query which you have to click on in order to see the actual records returned.

 

SELECT SFSSDupeCatcher__Duplicate_Warning_Count__c, Name, SFSSDupeCatcher__Scenario_Rule_Count__c, SFSSDupeCatcher__Scenario_Type__c, SFSSDupeCatcher__Potential_Duplicate_Count__c, (Select Name From SFSSDupeCatcher__Scenario_Rules__r) FROM SFSSDupeCatcher__Scenario__c

 

Is there any way to display a Parent-Child's sub query results also in the query results that are returned? I need to be able to export all results to a .csv file.

 

Thanks in advance for any help that you can give me with this.

Best Answer chosen by Admin (Salesforce Developers) 
dphilldphill

Try doing the query directly on the child:

 

SELECT SFSSDupeCatcher__Scenario__r.SFSSDupeCatcher__Duplicate_Warning_Count__c, SFSSDupeCatcher__Scenario__r.Name, SFSSDupeCatcher__Scenario__r.SFSSDupeCatcher__Scenario_Rule_Count__c, SFSSDupeCatcher__Scenario__r.SFSSDupeCatcher__Scenario_Type__c, SFSSDupeCatcher__Scenario__r.SFSSDupeCatcher__Potential_Duplicate_Count__c, Name FROM SFSSDupeCatcher__Scenario_Rules__c ORDER BY SFSSDupeCatcher__Scenario__c

 

All Answers

SurpriseSurprise

You mean  graphical representation of your data such as parent and chilld records.

 

Check  below given link,May be of some help.

 

http://techsahre.blogspot.com/2011/05/generate-multi-sheet-excel-file-in.html

 

 

dphilldphill

Try doing the query directly on the child:

 

SELECT SFSSDupeCatcher__Scenario__r.SFSSDupeCatcher__Duplicate_Warning_Count__c, SFSSDupeCatcher__Scenario__r.Name, SFSSDupeCatcher__Scenario__r.SFSSDupeCatcher__Scenario_Rule_Count__c, SFSSDupeCatcher__Scenario__r.SFSSDupeCatcher__Scenario_Type__c, SFSSDupeCatcher__Scenario__r.SFSSDupeCatcher__Potential_Duplicate_Count__c, Name FROM SFSSDupeCatcher__Scenario_Rules__c ORDER BY SFSSDupeCatcher__Scenario__c

 

This was selected as the best answer
kiwitrotterkiwitrotter

Hi dphill,

 

Sorry for only replying to your suggestion now. Thank you very much, this indeed worked for me so thanks again for your help!