SAP Knowledge Base Article - Public

2118506 - Error: "Failed to retrieve data from the database. Qualified column could not be bound." when reporting on Salesforce.com in Crystal Reports

Symptom

  • Error: "Failed to retrieve data from the database. Details: 42S22:[Simba][SQLEngine[(31400) Qualified column could not be bound: <Object Name> [ Database Vendor Code: 31400 ]"
  • When refreshing a report in Crystal Reports 2013, based on Salesforce.com, it fails with the error.
  • Same report refresh successfully in Crystal Reports 2011 and below.
            
            
  • Note: Images and data in this SAP Knowledge Base Article is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
          
  • Salesforce.com

Reproducing the Issue

  1. In Crystal Reports 2011 or below, create a new report on Salesforce.com data source.
  2. Add a Command Object, and enter a SOQL query that uses alias like:
       
         Select c.Account.Name, c.id, c.name from contact c 
      
  3. Notice the report refresh successfully.
  4. Refresh the same report in Crystal Reports 2013, and it will fail with the error:
      
    "Failed to retrieve data from the database.
      Details: 42S22:[Simba][SQLEngine[(31400) Qualified column could
      not be bound: c.Account.Name [ Database Vendor Code: 31400 ]"
      
    Error - 01.png

Cause

  • The issue occurs due to the table alias used in the SOQL, and alias are unfortunately not supported by the Salesforce.com ODBC driver bundled with Crystal Reports 2013.
  • A product enhancement was created to request the support of Alias under SAP Note 2124918
          
  • Crystal Reports 2011 and below did not use the Salesforce.com ODBC driver. It was connecting using a JDBC driver. And this is why it is working in Crystal Reports 2011 as the JDBC driver bundled did not have this limitation.

Resolution

  • The Salesforce.com ODBC driver in Crystal Reports 2013 was enhanced to support Salesforce.com Alias in a Salesforce Query (SOQL) in the following product update:
        
    • Crystal Reports 2013
      • Support Pack 07 and above
             
             
  • If you cannot apply the latest product update that contains the enhancement, then to successfully refresh the report in Crystal Reports 2013, remove the Alias from the SOQL query.
         
    1. Open the report in Crystal Reports, and under the menu "Database", select "Database Expert..."
    2. In the "Database Expert" window, under "Selected Tables", right click on the command, and select "Edit Command"
    3. In the "Modify Command" window, remove the Alias used in the SOQL, and click "OK" 
          
      For example, if the report was using the following SOQL where the Contact table was alias with "c"
         
             Select c.Account.Name, c.id From Contact c
       
      Replace the alias, "c", by the actual table name, which is "Contact". In this example, the SOQL will then look like:
         
             Select Contact.Account.Name, Contact.id From Contact

Keywords

Sforce, SOQL, CR , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem

Product

SAP Crystal Reports 2013 ; SAP Crystal Reports 2016