Showing posts with label Crystal Report. Show all posts
Showing posts with label Crystal Report. Show all posts

Tuesday, 19 April 2016

No result is rendered in Preview mode when using Crystal reports in .NET web application

We encountered this issue with several different reports on different servers. The report would render fine in other modes such as Microsoft Excel or PDF. But when viewing in the default Preview mode, we are not able to see anything loaded and just a blank page. There is no specific information or error logged, either.

All reports may have been working at one stage on the same server before. It can be likely related to the reinstall of Crystal Report runtime on the server but we are not sure the definite cause of the problem. However, the solution is to copy the files according to the steps below.

1) Run the report as usual while having the browser’s dev tool open and Network monitor is running
2) While the report is loading in Preview mode, you will find there will be some 404 error appears in the monitor screen
3) Once the page is loaded, check the 404 error details and see what files were missing
4) The file path would be something starts with c:\inetpub\wwwroot\aspnet_client
5) Navigate to the file path. The two folders that start with 4_0 and 2_0 may contain same files. So you can modify the folder name and copy the right files accordingly. If a folder is completely missing, you may create a new one and copy the content from the existing 4_0 folder.

Note: if your virtual directory is not hosted on the c:\, you may need to do this to the same drive and the entire c:\inetpub folder is required on that drive as well.

Thank you for the person who posted the solution here and there are some variations of this problem that can be fixed in the same way.

Friday, 2 January 2015

Why all icon images are missing in Crystal Reports Web Viewer?

There is an issue happens to Crystal Reports Web Viewer very often. It is about the icons on the interface all disappeared at certain point of time. It does not affect the functionality of the buttons or viewing of the report contents. But it does not look professional for a business application.

We found there are several options can be used to solve this problem:

Option 1: add the site in the Compatibility View list in IE. This solution works when not only the icons are missing but also the report format looks wrong and different than designed.

Option 2: reinstall the Crystal Reports runtime. Usually, this happens when the .NET framework installed after the Crystal Reports runtime was installed. So we need to reinstall the Crystal Reports runtime again to ensure all related contents are in the correct place.

Option 3: an alternate way of Option 2 without reinstallation is to find the C:\inetpub\wwwroot\aspnet_client\system_web\ folder on the web application server. There will be several folders named after different versions of .NET framework e.g., 2_0_50727*, 4_0_30319*, etc.

As usually the highest .NET framework is used by the web application, open the lower version folder e.g., 2_0_50727* and there will be a folder called CrystalReportWebFormViewer4. In this folder, there would be all the images used on the Crystal Reports Web Viewer. You can copy the entire folder to the highest version numbered folder such as 4_0_30319* in our example. By saying so, you will still need to check which .NET framework your web application uses just in case and operate accordingly.

Wednesday, 31 December 2014

Specific server name used by sub-reports in Crystal Reports that running in a web application

We use .NET application and Crystal Reports plug-in to run Crystal Reports in the .NET web application. Recently, we discovered that one of the reports we built throws SQL column missing error while running in the web application. It is unusual as all our reports are built in the same way.

At the end, we figured out that it was due to the report uses sub-reports and all sub-reports require to be saved with . as the server name in the Crystal Reports file. So that when it runs from the web application, it would then work successfully. In addition, we found this is the only solution and it will fail even when replacing the . with localhost.

This is an unusual solution that we normally do not see. So I record this here for future references.

Wednesday, 24 December 2014

Crystal Reports do not export page headers in Microsoft Excel (Data Only) format

Recently, I found when using Crystal Report to output to Microsoft Excel (Data Only) format. The page headers are not exported in this format.

I have done some researches on the Internet and found the export of page headers to Microsoft Excel (Data Only) format is not supported.

I figured out that the only workaround to this (in my case) is to put all required page header content in report header. If they are required to be in multiple lines, we just need to create one report header for each line and put the related content in each report header. So the content will be displayed in multiple lines (rows) in the Microsoft Excel (Data Only) format.

Meanwhile, we need to make sure that the following two options are selected in Microsoft Excel (Data Only) Format Options in Crystal Report:

  • Export page header and page footer
  • Simplify page headers

This solution has fixed our internal reporting issue to Microsoft Excel (Date Only) format. Hope it will also benefit the others.

Thursday, 9 May 2013

The myth to dynamically display page header in Crystal Report

This is one of the Crystal myths I have come across.

We have two different page headers to display based on a boolean parameter. It works perfectly until we tried to export the report to Excel (Data Only) format. One of the parameter choice will cause the corresponding header not to be exported to that format. However, it works with the opposite parameter selection.

After many different tests, I found it is not to do with the parameter choice but just the position of the header section. As we have to create two page header sections to achieve this, it will always be the one at bottom section gets exported.

With some Internet search, I have eliminate the following common causes of issues to export to Excel (Data Only) format:

1. different fields width and height
2. different alignment with the Detail fields
3. uncheck Simplify page header option in the Excel(Data Only) format export options

At the end, I tried from a mew blank report just had single same field in each header. Use the same boolean parameter to show/hide one and another. It still did not work.

Concluded it is a bug and now, I have to think of a work around.

So I have tried to place these two headers together in one page header and use Supress formula on fields to do show/hide. Found if placing them in parallel, it still will not work until to place them at one line i.e., overlap each other. However, the fields exported to Excel (Data Only) are having spaces in between as the difference between these two headers.

So we had to just use one header and show and hide the extra coulmn(s) which will leave space if it is not show and hopefully, someone else can find the better solution on this.

Monday, 15 August 2011

String type parameter in Crystal Report imposes a critical security threat

Recently, we discovered the string type parameter used in Crystal Report is open for script injection i.e., a regular expression can be sent via these string type parameters and ran against the system database directly. But this only happens when the string is used with LIKE keyword in the SQL query.
For example, the query may look like this:
SELECT ComanyName
FROM Customers
WHERE CompanName LIKE {?CompanyParameter}
We have solved this issue by eliminating the special characters in the string which may impose threat before we send the string to Crystal Report. Hope this can be done in the future in Crystal Report itself and to prevent this major security threat from happening to any of the Crystal Report users.

Sunday, 14 August 2011

Daylight saving offset is not available in SQL scripting

We discovered a drawback by using SQL script and Crystal Report where the conversion against all the GMT date time fields in our database to local time does not cater for the daylight saving offset.

Unfortunately, the only way we found to overcome this issue is to create a new table which will record all the daylight saving information at different locations. Therefore, when we build Crystal Report, we can use the SQL query to check the daylight saving offsets and apply them correctly on different dates.

A google search link indicates that Crystal Report may have this function in place in version 2011.