skip to main content
Using the Driver : Using Reports
  

Try DataDirect Drivers Now

Using Reports

The Salesforce driver exposes reports defined on a Salesforce instance as stored procedures. An application can obtain a list of the reports defined on a Salesforce instance by calling the SQLProcedures catalog function. The names of the reports that can be invoked through the driver are listed in the PROCEDURE_NAME name column of the SQLProcedures results.
Salesforce organizes reports into folders. The Salesforce driver incorporates the folder name and report name into the procedure name reported by SQLProcedures. The driver creates the reported procedure name by prepending the folder name to the report name using an underscore to join them. Additionally, any spaces in the report or folder names are replaced with an underscore character. Like all identifier name metadata returned by the driver, the procedure name is uppercase. For example, if a report named Opportunity Pipeline is in the folder Opportunity Reports, it would be rendered as:
OPPORTUNITY_REPORTS_OPPORTUNITY_PIPELINE
An application invokes a report using the standard Call escape syntax, {call report name}, and ODBC mechanisms for calling a stored procedure that returns a resultset. The following example shows one way to invoke the Opportunity Pipeline report:
SQLRETURN      retVal;
HSTMT         hStmt = NULL;
SQLWCHAR*      sql;
sql = L"{call OPPORTUNITY_REPORTS_OPPORTUNITY_PIPELINE}";
retVal = SQLExecDirect(hStmt, sql, SQL_NTS);
if (SQL_SUCCESS == retVal) {
        //     process results
}
Note: The API used by the driver to obtain the list of reports and execute the reports is not an API that is documented by Salesforce. This API may change or may not be supported in the future.
Note: When passing parameters to stored procedures, reports are not supported.