hiratake55 / RForcecom

RForcecom provides the connection to Force.com and Salesforce.com from R
http://cran.r-project.org/web/packages/RForcecom/index.html
Other
49 stars 25 forks source link

Null values on lookups return name of object #7

Closed gnilrets closed 11 years ago

gnilrets commented 11 years ago

I have a query like that shown below. When the field gvpDistributorc is null, RForcecom seems to return the name of the object being queried (in this case, "Account")

select
    RecordType.Name,
    Id,
    Name,
    BillingPostalCode,
    BillingState,
    Owner.Username,
    gvp__Distributor__c,
    gvp__Distributor__r.Name,
    gvp__Distributor__r.RecordType.Name
from 
    Account
where
    RecordType.Name in ('On-Premise','Off-Premise')
limit 100
hiratake55 commented 11 years ago

Is your RForcecom version 0.5? If not, please try the commands below.

update.packages("RForcecom")
packageVersion("RForcecom")

I'm sure this issue was resolved in RForcecom 0.5.

gnilrets commented 11 years ago

I upgraded the package I had to 0.5:

packageVersion("RForcecom") [1] '0.5'

However, that does not resolve the issue. Instead, I get the following warning message:

q <- rforcecom.query(session,"

  • select
  • RecordType.Name,
  • Id,
  • Name,
  • BillingPostalCode,
  • BillingState,
  • Owner.Username,
  • gvpDistributorc,
  • gvpDistributorr.Name,
  • gvpDistributorr.RecordType.Name
  • from
  • Account
  • where
  • Id in ('001E000000PSqw4IAD','001E000000PSqw3IAD')
  • ") Warning message: In function (..., deparse.level = 1) : number of columns of result is not a multiple of vector length (arg 2)

The fields that should be null are still not null. In this example, gvpDistributorc is null in the data source but shows up as "Account" in q. Likewise, gvpDistributorr.Name is null in the data source but it shows up as "/services/data/v25.0/sobjects/Account/001E000000PSqw4IAD".

I only get the warning message when there is at least one other value in the column that is non-null. If all of the values are null, there is no warning message and null fields simply do not show up in the data frame.

hiratake55 commented 11 years ago

Patched the issue on RForcecom 0.6. Would you update and try it again?

gnilrets commented 11 years ago

Yes, that works. Thank you!