0

I am trying to extract data using Data Loader command line but can't get aliases to work.

The following SOQL query will work perfectly fine in the Developer console:

Select Hub_Name__r.Name hubName, Account__r.Name accName, Count(ID) FROM Survey_Results__c WHERE Survey_Date__c = THIS_MONTH Group By Hub_Name__r.Name, Account__r.Name ORDER By Hub_Name__r.Name ASC, Account__r.Name ASC

But when I try and run it via command line with data loader I get this error:

2020-03-20 17:10:46,534 ERROR [MgrDash_Surveys] progress.NihilistProgressAdapter doneError (NihilistProgressAdapter.java:58) - No such field name hubname on entity BCS__c

So I try to remove the aliases to fix that issue but then I get this error:

2020-03-20 17:17:47,745 ERROR [MgrDash_Surveys] progress.NihilistProgressAdapter doneError (NihilistProgressAdapter.java:58) - duplicate alias: Name

I have tried many ways to try and fix this but nothing seems to work. Is there some special way that aliases have to be identified with Data Loader in command line mode?

  • I think you have some experience with this @sfdcfox – Matt M Mar 20 at 22:21
0

I believe this is actually a limitation of how the Data Loader parses queries. I can't find documentation on this either way. However, as a matter of practicality, I'd recommend using sfdx for tasks like this:

sfdx force:data:soql:query -t csv -u username -q "Select Hub_Name__r.Name hubName, Account__r.Name accName, Count(ID) FROM Survey_Results__c WHERE Survey_Date__c = THIS_MONTH Group By Hub_Name__r.Name, Account__r.Name ORDER By Hub_Name__r.Name ASC, Account__r.Name ASC"

Which should give you the output you're looking for. If you want this in a file, just redirect from stdout:

sfdx ... > output.csv
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.