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
dchealthcaredchealthcare 

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

When we try to run a  simple  ‘join’ query  (below) we can only see the columns from the driving table  ( In this case Account History Child table is the driving table)  however the columns from Parent tables appears as a Link  (in this case Account).

 

We  understand that the clicking on the link gives  the selected columns of  the Parent table as a pop up but  we want  every selected column from both Tables on the display  (Just like  the Query editor does)  and export the entire  result  set to a  CSV file. The only  reason we started using ‘Force explorer’  is because  ‘Query Editor’  doesn’t  allow bulk export.  ‘Data Loader’  also does export but it doesn’t allow Joins.

 

Can you help  if there is a quick fix or way out for this ?

 

/*******************************

SELECT Account.ID,Account.FirstName ,Account.LastName

      ,Account.PersonBirthDate ,Account.Phone ,Account.CreatedDate

      ,Account.LastModifiedDate ,Account.LastModifiedByID

      ,AccountHistory.AccountID, AccountHistory.ID

      ,AccountHistory.Field ,AccountHistory.NewValue

      ,AccountHistory.OldValue ,AccountHistory.CreatedDate

      ,AccountHistory.CreatedById ,AccountHistory.Isdeleted

FROM  AccountHistory

WHERE Account.LastModifiedDate > 2013-10-08T00:00:00Z

  and AccountHistory.Field = 'Phone' order by Account.ID

*****************************/

Subhani PSubhani P

Hi

 

Can you try the below example for your solving your question??

 

http://boards.developerforce.com/t5/Apex-Code-Development/Question-on-how-to-display-SOQL-sub-query-results-in-result-set/td-p/604497

 

Thanks,
Subhani,
Salesforce Certified Developer,
www.mydbsync.com

dchealthcaredchealthcare

Subhani,

Thanks for replying but I'm already doing what is written in the example below.  My  driving table  is the Child  table "AccountHistory"   and I'm selecting some columns (actually 8) from  "AccountHistory"  and some columns (actually 8) from its Parent table  "Account".

 

As I said - the query runs and the results also comes , but  the issue is  the columns for "Account"  doesn't  appear in the resultset display , rather one column comes with a link like  Account.   Naturally when you export  that  result set to CSV , it  has  8 columns from "AccountHistory"   and just one Pointer column from "Account"  which means total 9  instead of  all the 16 columns as  a result of the that SOQL.

 

I have tried running the same SOQL  in Developer Console -> Query Editor  where it displays all 16 columns ( 8 from Account  and 8 from AccountHistory)  nicely but  I can't  export  the results from "Query Editor".

 

We came to  "Force Explorer" because it can execute SOQL involving joins between tables and also can  export  the results - BUT the problem is  its displaying and exporting  partially.

 

Any workaround ? 

 

We just want  the entire result set  exported n a CSV file with all columns that we Selected - that's all.

 

Thanks so much !!

Diptam

 

vikram.sridharan1.3928386184824226E12vikram.sridharan1.3928386184824226E12

Hi Diptam - Did you resolve this situation?  If you did can you post how?

Thanks