0

I am trying to query two objects in salesforce via their parent-child relationship, using the R package RForcecom (read more about RForcecom here).

I have successfully used RForcecom to query one object at a time, but can't tell from the documentation if it's possible to use this package to enter a relationship query. Such as:

    SELECT Account__c,Reporting_Period__c,Year__c,Product_Family__c
        ( SELECT ID,Transaction_Date__c,Total_Volume__c FROM Transaction__c )
    FROM Licensee_Report__c 

All of these field and object names refer to real fields/objects and are the correct API names for our salesforce instance. This is just an example and serves to highlight the kind of multi-object query I am hoping to make.

Normally, RForcecom lets you use the function rforcecom.query() to run SOQL queries after having logged into the API within R. See the link above for more.

Currently, I'm getting an error message where I open the parentheses for the sub-query on the child object, and the message 'unexpected token: 'SELECT''

Any ideas?

2

There's a comma missing in front of your inner query. It should look like this:

 SELECT Account__c,Reporting_Period__c,Year__c,Product_Family__c,
        ( SELECT ID,Transaction_Date__c,Total_Volume__c FROM Transaction__c )
    FROM Licensee_Report__c 

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.