Crystal Reort XI Developer Ed  
Author Message
Rajnesh





PostPosted: Visual Basic Express Edition, Crystal Reort XI Developer Ed Top

Hi friends need some help,,

can i create a report with crystal report XI Developer Ed in VB Expression Edition and use them too..

Warm regards

rajnesh



Visual Studio Express Editions28  
 
 
spotty





PostPosted: Visual Basic Express Edition, Crystal Reort XI Developer Ed Top

VB Express doesnt come with Crystal Reports - but if you have purchased it separately then there shouldnt be any reason why it wouldnt work.


 
 
Gareth Ch





PostPosted: Visual Basic Express Edition, Crystal Reort XI Developer Ed Top

The details:

I am writting an app that creates monthly reports of sales for all customers of a specific type. I basically runs in batch and spits out a pdf format of a report showing the details for each customers monthly transactions, yearly totals, contanct info etc. Although I havent finished yet I can create the reports I want with out too much difficulty. BUT I cant seem to view the reports in a "CrystalReportViewer" object while the program is running and I am assuming this is because CR CAN NOT INTEGRATE with Visual Studio Express as it does with Visual Studio.

To be able to create reports and then save, export, print or view (by first exporting to pdf then viewing pdf file) this is what I have done -

Crystal reports does not ship with Visual Studio Express as it does with Visual Studio so you will obviously have to buy the full product from Business Objects which is not all a bad thing because there is more functionality than the Crystal Reports.Net bundled with Visual Studio.

Now according to Business Objects: in order to use the full version of cystal reports with Visual Studio (they do not mention Express so I assume this actually only refers to Visual Studio but might be important, - I did it and it works) you will need to install Crystal Reports XI Release 2. It is basically Crystal Reports 11 (XI) but is adapted to work with .Net 2.0 ie Visual Studio 2005. Its verison number should be 11.5.(something) as apposed to CR XI which is version 11.0 or something close.

Use CR XI R2 to create reports as standard then add the relevant crystal references to your VB express solution:

crystaldecisions.crystalreports.engine

crystaldecisions.reportsource

crystaldecisions.shared

crystaldecisions.windows.forms

add your report file to your project and then use the "report object model" (see crystal reference for info) to create a reprt object, load your report, format it, select data to display, export or print or whatever. Just remember that you cant view it in the crystal report viewer on your windows form or at least I havent been able to figure it out yet.

Here is some code:

'Declarations

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared

'In Class

Dim customerReport As ReportDocument

customerReport = New ReportDocument()

Dim reportPath As String = Application.StartupPath & "\" & "CustMonthly.rpt" ' I saved my report in the "\BIN\Debug" dir

customerReport.Load(reportPath)

Dim strPath As String

Dim strFileName As String

'Filename made up of customer number, year, month

strFileName = strCust & "_" & intYear.ToString & "_" & intMonthStart.ToString

'Path to save pdf report to and filename saved as

strPath = Application.StartupPath & "\reports\" & strFileName & ".pdf"

customerReport.ExportToDisk(ExportFormatType.PortableDocFormat, strPath)

Viola - you have a report in pdf

Now to select or filter data I change the RecordSelectionFormula as so: (You can also use parameters, dataviews/datatables etc)

customerReport.RecordSelectionFormula = "(({customer.Cust_Number} = '" & strCust & "' AND {auditall.Year} = " & intYear & ") AND ({auditall.Month} >= " & intMonthStart & " and {auditall.Month} <= " & intMonthEnd & ")) "

This selects records matching strCust, intYear, and in month range defined between intMonthStart and intMonthEnd.

For subreport data filtering etc ("YTD" is name of subreport.)

customerReport.Subreports("YTD").RecordSelectionFormula = "( {customer.Cust_Number} = '" & strCust & "' AND ({auditall.Period} < 200611 and {auditall.Period} >= 200511 ) )"

I must say that the fact that you cant use a crystal report viewer in my windows forms is really upsetting me but luckily in my case the reports are going to be emailed or printed/faxed from the pdf files so it should work out ok (No jinxes here!)

FYI - I am not a serious developer and am pretty knew to Visual Studio Express and Crystal XI. Last developed Visual Studio.Net and intergrated Crystal in 2002! I know my solution is not pretty but it is working for my needs. Hope that helps some people who have been stumped like I have been for way to long.



 
 
Gareth Ch





PostPosted: Visual Basic Express Edition, Crystal Reort XI Developer Ed Top

The details:

I am writting an app that creates monthly reports of sales for all customers of a specific type. I basically runs in batch and spits out a pdf format of a report showing the details for each customers monthly transactions, yearly totals, contanct info etc. Although I havent finished yet I can create the reports I want with out too much difficulty. BUT I cant seem to view the reports in a "CrystalReportViewer" object while the program is running and I am assuming this is because CR CAN NOT INTEGRATE with Visual Studio Express as it does with Visual Studio.

To be able to create reports and then save, export, print or view (by first exporting to pdf then viewing pdf file) this is what I have done -

Crystal reports does not ship with Visual Studio Express as it does with Visual Studio so you will obviously have to buy the full product from Business Objects which is not all a bad thing because there is more functionality than the Crystal Reports.Net bundled with Visual Studio.

Now according to Business Objects: in order to use the full version of cystal reports with Visual Studio (they do not mention Express so I assume this actually only refers to Visual Studio but might be important, - I did it and it works) you will need to install Crystal Reports XI Release 2. It is basically Crystal Reports 11 (XI) but is adapted to work with .Net 2.0 ie Visual Studio 2005. Its verison number should be 11.5.(something) as apposed to CR XI which is version 11.0 or something close. You can use our same license/product registration info for both versions and they can be installed side by side on machine.

Use CR XI R2 to create reports as standard then add the relevant crystal references to your VB express solution:

crystaldecisions.crystalreports.engine

crystaldecisions.reportsource

crystaldecisions.shared

crystaldecisions.windows.forms

add your report file to your project and then use the "report object model" (see crystal reference for info) to create a reprt object, load your report, format it, select data to display, export or print or whatever. Just remember that you cant view it in the crystal report viewer on your windows form or at least I havent been able to figure it out yet.

Here is some code:

'Declarations

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared

'In Class

Dim customerReport As ReportDocument

customerReport = New ReportDocument()

Dim reportPath As String = Application.StartupPath & "\" & "CustMonthly.rpt" ' I saved my report in the "\BIN\Debug" dir

customerReport.Load(reportPath)

Dim strPath As String

Dim strFileName As String

'Filename made up of customer number, year, month

strFileName = strCust & "_" & intYear.ToString & "_" & intMonthStart.ToString

'Path to save pdf report to and filename saved as

strPath = Application.StartupPath & "\reports\" & strFileName & ".pdf"

customerReport.ExportToDisk(ExportFormatType.PortableDocFormat, strPath)

Viola - you have a report in pdf

Now to select or filter data I change the RecordSelectionFormula as so: (You can also use parameters, dataviews/datatables etc)

customerReport.RecordSelectionFormula = "(({customer.Cust_Number} = '" & strCust & "' AND {auditall.Year} = " & intYear & ") AND ({auditall.Month} >= " & intMonthStart & " and {auditall.Month} <= " & intMonthEnd & ")) "

This selects records matching strCust, intYear, and in month range defined between intMonthStart and intMonthEnd.

For subreport data filtering etc ("YTD" is name of subreport.)

customerReport.Subreports("YTD").RecordSelectionFormula = "( {customer.Cust_Number} = '" & strCust & "' AND ({auditall.Period} < 200611 and {auditall.Period} >= 200511 ) )"

I must say that the fact that you cant use a crystal report viewer in my windows forms is really upsetting me but luckily in my case the reports are going to be emailed or printed/faxed from the pdf files so it should work out ok (No jinxes here!)

FYI - I am not a serious developer and am pretty knew to Visual Studio Express and Crystal XI. Last developed Visual Studio.Net and intergrated Crystal in 2002! I know my solution is not pretty but it is working for my needs. Hope that helps some people who have been stumped like I have been for way to long.