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

Thursday, 4 April 2019

Crystal Report - "Format with multiple columns"

In this post, I will explain ‘Format with multiple columns’ feature of the crystal report.

In some situation, we want to print data in multiple columns instead of data print straight down the page. In crystal report, we can achieve this by using "Format with multiple columns" feature of the crystal report.

List of cities to format with multiple columns
List of cities to format with multiple columns

 To create a multiple-column report:

1. Open the report to format with multiple columns.

2. Right-click on details section, click Section Expert.

3. In the Section Expert, Under Common tab select Format with Multiple Columns checkbox.

This will add a Layout tab to the section expert.
Select Format with multiple columns
Select Format with multiple columns

4. Click the Layout tab and set the Width you want for columns.
Set Width and Horizontal and Vertical gap
Set Width and Horizontal and Vertical gap

5. Set the Horizontal and Vertical gap between each record in columns.

6. In the Printing Direction area, choose a direction.

Across then down - Will print value in next column then in next row.

Result of Across then down
Result of Across then down

Down then across – Will print value in next row till page end then in a new column.

Result of Down then across
Result of Down then across

7. Select Format Groups with multiple columns, if report formatting contains grouping.

8. Click OK.

Thursday, 28 March 2019

Dynamically change decimal places in Crystal Reports

In this post, I will explain how to dynamically change decimal places in Crystal Report. To explain this I have created a sample table and sample crystal report in my example.

tbl_Sample contains a column id, decimalPlaces and Amount. 

Dynamically change decimal places in Crystal Reports

I want to format the Amount in crystal report as per the value of decimalPlaces. If decimalPlaces value is 3 then formatted Amount will be 123.256.

In the sample crystal report I added tbl_Sample as Datasource and designed crystal report as per below image.

Dynamically change decimal places in Crystal Reports

Steps to Dynamically change decimal places in Crystal Report

1. Right click on "Amount"

Dynamically change decimal places in Crystal Reports

2. On "Format Editor" window, click "Customize" button

Dynamically change decimal places in Crystal Reports

3. On "Custom Style" window, Click "X2" in front of Decimals

Dynamically change decimal places in Crystal Reports

4. On "Format Formula Editor" window, drag decimalPlaces field from report field to editor and click "Save and close" button

Dynamically change decimal places in Crystal Reports

5. Back on "Custom Style" window, Click "X2" in front of Rounding

Dynamically change decimal places in Crystal Reports

6. On "Format Formula Editor" window, drag decimalPlaces field from report field to editor and click "Save and close" button

Dynamically change decimal places in Crystal Reports

After doing all these changes to Amount field you will get a below result

Dynamically change decimal places in Crystal Reports

Tuesday, 14 August 2018

Crystal Reports

Crystal Reports is a popular report designing tool that allows a programmer to create reports from a variety of data sources with a minimum of written code. Developed by Seagate Software, Crystal Reports can access data from most widely-used databases and can integrate data from multiple databases within one report using Open Database Connectivity (ODBC).

Crystal Reports can create a report on the fly from user-defined variables and can convert it to HTML and publish it to the Web automatically. We can export the report in different format like PDF, Word, Excel etc.

Crystal Reports uses an ActiveX control called Crystal Report to establish a connection with another program. A programmer can set properties of the Crystal Report control during design time or at run time.

The programmer can use automation tools called Experts to be guided through common tasks, such as linking and embedding reports. Crystal Reports treats all text, graphics, and database fields as object s that a programmer can place, arrange, and format on forms. The program also generates a recordset object and code needed to perform programming tasks such as loop s or mathematical calculations.

Crystal Reports
Crystal Reports User Interface