Connect to and Query Salesforce Data in QlikView 
Tags: integration, connectivity, database
Published: 2021-07-21 12:28:49

QlikView is a business discovery platform that helps business users perform self-service business intelligence. This article explains how to use the [CData ODBC Driver to connect to Salesforce data](https://www.cdata.com/drivers/salesforce/odbc/?utm_source=dev.to&utm_medium=blog-post&utm_campaign=Connect-to-and-Query-Salesforce-Data-in-QlikView+) and create data visualizations in QlikView. 

When you send advanced SQL queries from QlikView to Salesforce, the driver sends supported SQL operations straight to Salesforce, such as filters and aggregations, and uses the embedded SQL engine to perform unsupported actions (typically SQL functions and JOIN operations) client-side. 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. 

 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0197zaj5hxcct2lbfnak.png)

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

 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/drmrtvfdo3d2urcdok2p.png)

4. A command like the following is generated: 

[view source](https://www.cdata.com/kb/articles/salesforce-odbc-qlikview-chart.rst?utm_source=dev.to&utm_medium=blog-post&utm_campaign=Connect-to-and-Query-Salesforce-Data-in-QlikView+#viewSource) 

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). 

[view source](https://www.cdata.com/kb/articles/salesforce-odbc-qlikview-chart.rst?utm_source=dev.to&utm_medium=blog-post&utm_campaign=Connect-to-and-Query-Salesforce-Data-in-QlikView+#viewSource) 

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

Where possible, the SQL operations in the query, like filters and aggregations, will be pushed down to Salesforce, while any unsupported operations (which can include SQL functions and JOIN operations) will be managed client-side by the CData SQL engine embedded in the driver. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1d31if1p16d7wnovtnmi.png)
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 see real-time changes. Live connections are possible and effective, thanks to the high-performance data processing native to CData ODBC drivers. 

 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7jyg7yz69haulu44opvb.png)

## More Information 

The Salesforce ODBC Driver allows you to connect with live Salesforce account data, directly from any applications that support [ODBC connectivity](https://www.cdata.com/odbc/?utm_source=dev.to&utm_medium=blog-post&utm_campaign=Connect-to-and-Query-Salesforce-Data-in-QlikView+).  

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