! 제품 버전을 정확하게 입력해 주세요.
제품 버전이 정확하게 기재되어 있지 않은 경우,
최신 버전을 기준으로 안내 드리므로
더욱 빠르고 명확한 안내를 위해
제품 버전을 정확하게 입력해 주세요!

[EN] .NET을 사용하여 Salesforce 및 Crystal Reports 용 기회 보고서를 작성하는 방법 > 블로그 & Tips

본문 바로가기

ComponentOne

블로그 & Tips

[EN] .NET을 사용하여 Salesforce 및 Crystal Reports 용 기회 보고서를 작성하는 방법

페이지 정보

작성자 GrapeCity 작성일 2021-11-04 14:43 조회 10,350회 댓글 0건

본문

Crystal Reports provides a Visual Studio integrated report designer to create reports. It has an in-built feature to integrate with project data sources that developers can quickly create reports in a familiar environment.

When it comes to generating reports based on internet-based data sources, the integration is not that straightforward; as a developer, you either have to design a disconnected report and bind it at runtime with data received from the web services or create your typed classes, map with web service and then design the report.

ComponentOne solves this problem by providing DataConnectors for popular online CRM such as Salesforce & Dynamics365, accounting systems like QuickBooks Online, workflow solutions like Kintone, website analytics like Google Analytics, and even OData. These data connectors provide many features like CRUD, Caching, Batching, SQL, and LINQ query support, to name a few.

In the 2021 v2 release of ComponentOne, these data connectors have been integrated with Visual Studio, meaning you can use Server Explorer to connect to any of the above sources using these data connectors, generate datasets, visually build queries or write SQL.

This also means that a table from these online data sources is available as 'Project Data Source' when you create a dataset.

This makes it easy for a developer to create reports using Crystal Reports designer against the above-mentioned internet-based data sources. This blog will walk through the steps required to build a report using the Salesforce Opportunities table to get information about sales leads at various stages.

ComponentOne DataConnectors are available under DataServices in the installer. When you install the DataServices, it would integrate the data connectors with visual Studio and install the samples.


Connect to Salesforce


1. Create a WinForms application.

2. Open ServerExplorer, right-click the "Data Connections" node, click "Add Connection". On the "Add Connection" screen, click "Change." This should open the below screen, select "C1 Salesforce Data Source" from the list and click "OK".

data source


The next screen will ask you to enter credentials for your Salesforce instance. The Salesforce data connector supports OAuth-based credentials.


salesforce


This document explains how to set up an app to enable OAuth. The following information is required to connect to Salesforce:

  • Token endpoint

  • API URL

  • Client ID

  • Client secret

  • Salesforce username and password

  • Security token

  • Enter the above details on this screen and click "OK". This should connect to Salesforce and show all available tables, as below:

connected



Add DataSet


1. Right-click on the project in the solution explorer and select "Add Item" from the context menu. On the "Add New Item" screen, select "DataSet", name it "Salesforce," and click "Add".

add dataset 


2. Open the Salesforce dataset designer and drag-and-drop the "Opportunity" table from the "Tables" node of Salesforce:

data set

3. Save the project.



Design Opportunity Report in Crystal Reports


1. On Form1, drop a CrystalReportViewer control from the toolbox. If you do not have CrystalReports in your toolbox, you can get it here.


2. From the smart-tag of the CrystalReportViewer, click the "Create a New Crystal Report" option.

crystal reports


3. Specify a report name on the next screen.

wizard


4. On the Crystal Report Gallery screen, select the "Using the Report Wizard" radio button, choose "Standard" under "Choose an Expert," and click OK.

gallery


5. On the next screen, select the "Opportunity" table from the Salesforce dataset. Click "Next".

opportunity


6. On the "Fields" screen, select the following fields: StageName, ExtendedRevenue, Name, and CloseDate. Click "Next".

fields


7. On the next screen, choose "StageName" to group the report. Click "Next".

stage name


8. On the summaries screen, choose to summarize the report by the "ExpectedRevenue" field. Click "Next".

revenue


9. On the next screen, choose to sort by StageName and click "Next".

wizard


10. On the chart screen, select the "Bar Chart" radio button, use the default chart title, set "On change of" to StageName, and set "Show summary" to "ExpectedRevenue".

summary


11. On the next screen, select "Next" and then "Finish". The report viewer is configured and shows the report layout at design time. It also creates the "Opportunity.rpt" report file and adds an "Opportunity1" CrystalReport control to the component tray.

design


Fill Data and View Report

We now need to fill the dataset with data from Salesforce, so in the Form_Load event, we fill the Opportunity table of the dataset with data using Salesforce DataAdapter.

private void Form1_Load(object sender, EventArgs e)
      {
          //Create an instance of salesforce dataadapter
          SalesforceTableAdapters.OpportunityTableAdapter oa = new SalesforceTableAdapters.OpportunityTableAdapter();
          //create an instance of Salesforce dataset
          Salesforce ds = new Salesforce();
          //fill opportunity table of the salesforce dataset
          oa.Fill(ds.Opportunity);
          // set the data source of Opportunity CrystalReport instance
          Opportunities1.SetDataSource(ds);
      }


Run the application to view the report:

report


It is always good to cache data from internet data sources and refreshes it after a certain threshold. ComponentOne DataConnectors provide an in-built feature to cachedata locally. It can be configured in the connection string itself.

In this case, the connection string was saved in the app.config, we would need to set "Use Cache" to true, set a "Cache Location" for the cache database, and a value for "Cache Tolerance," after which the data would be refreshed.

You also have the option to cache data to SQLite(default) or SQL Server. You can also incrementally update the cache for further performance gains.





지금 바로 ComponentOne을 다운로드하여 직접 테스트해보세요!

 
  • 페이스북으로 공유
  • 트위터로  공유
  • 링크 복사
  • 카카오톡으로 보내기

댓글목록

등록된 댓글이 없습니다.

메시어스 홈페이지를 통해 제품에 대해서 더 자세히 알아 보세요!
홈페이지 바로가기

태그1

메시어스 홈페이지를 통해 제품에 대해서 더 자세히 알아 보세요!
홈페이지 바로가기
이메일 : sales-kor@mescius.com | 전화 : 1670-0583 | 경기도 과천시 과천대로 7길 33, 디테크타워 B동 1107호 메시어스(주) 대표자 : 허경명 | 사업자등록번호 : 123-84-00981 | 통신판매업신고번호 : 2013-경기안양-00331 ⓒ 2024 MESCIUS inc. All rights reserved.