SQLServerCentral Article

Connect to and Query Salesforce Data in QlikView


QlikView is a business discovery platform that helps anyone perform self-service business intelligence. This article explains how to use the CData ODBC Driver to connect to Salesforce data and create data visualizations in QlikView. 

When you send advanced SQL queries from QlikView to Salesforce, the driver sends supported SQL operations, such as filters and aggregations straight to Salesforce and performs unsupported actions (e.g. SQL functions and JOIN operations) client-side using the embedded SQL engine. You can visualize and analyze Salesforce data using native QlikView data types thanks to built-in dynamic metadata querying. 

Connect to Salesforce as an ODBC Data Source 

If you have not already, first specify connection properties in an ODBC DSN (data source name). This is the last step of the driver installation. You may create and configure ODBC DSNs with the Microsoft ODBC Data Source Administrator. 

To connect to Salesforce, you can use one of three authentication methods: login, OAuth, or SSO. You'll need the user's username, password, and security token to use the Login method. In case you do not have access to the username and password or do not want to require them, you can use OAuth authentication. 

SSO (single sign-on) can be used by setting the SSOProperties, SSOLoginUrl, and TokenUrl connection properties, which allow you to authenticate to an identity provider. 

See the "Getting Started" chapter in the help documentation for more information. 

Populate a Chart with Salesforce Data 

The instructions below show how to import the results of a SQL query into a QlikView visualization. In this article, you will create a bar chart with the query below: 

SELECT Contact.Name, SUM(Account.AnnualRevenue) FROM Contact, Account GROUP BY Contact.Name;
  1. Click File -> Edit Script (or click the Edit Script button in the Toolbar).
  2. On the Data tab, select ODBC in the Database menu and click Connect. 

3. Select the DSN (CData Salesforce Sys) in the resulting dialog. 

4. A command like the following is generated: ODBC CONNECT TO \[CData Salesforce Sys]; 

5. Enter the SQL query directly into the script with the SQL command (or click Select to build the query in the SELECT statement wizard). 

SQL SELECT Contact.Name, SUM(Account.AnnualRevenue) FROM Contact, Account GROUP BY Contact.Name;

Where possible, the SQL operations in the query, such as filters and aggregations, will be pushed down to Salesforce. Any unsupported operations (SQL functions and JOIN operations) will be managed client-side by the CData SQL engine embedded in the driver. 

6. Close the script editor and reload the document to execute the script. 

7. Click Tools -> Quick Chart Wizard. In the wizard, select the chart type. This example uses a bar chart. When building the chart, you have access to the fields from Salesforce, typed appropriately for QlikView, thanks to built-in dynamic metadata querying. 

8. When defining Dimensions, select Contact.Name in the First Dimension menu. 

9. When defining Expressions, click the summary function you want and select AnnualRevenue in the menu. 

10. Finish the wizard to generate the chart. The CData ODBC Driver for Salesforce connects to live Salesforce data so the chart can be refreshed to show real-time changes. Live connections are possible and effective thanks to the high-performance data processing native to CData ODBC drivers. 

More Information 

The Salesforce ODBC Driver allows you to connect with live Salesforce account data directly from any application that supports ODBC connectivity 

By providing industry-standard connectivity, CData Drivers democratize Salesforce access, allowing everyone in the organization, from IT professionals and app developers to citizen analysts and data scientists, to work with and find value from the entire Salesforce platform.