Skip to Content

Crystal Reports version:

2008

Scenario:

Suppose we need to display string data for multiple fields in a single section Crystal Report. There is a possibility of data being overlapped if the “Can Grow” option is selected for string fields. Also when there is no data for a particular field (say we need to suppress the respective label also), the blank space will be displayed. This blog explains how to avoid the above 2 scenarios.

Sample Screenshots:

1) Screenshot for overlapping of data and blank space issue when multiple data is displayed in single section.

 Fig(1)

2.) Screenshot for data with multiple section approach to avoid overlapping and blank space issues.

 Fig(2)

Approach:

In the first screenshot, since multiple fields placed one below the other and also since “Can Grow” is enabled, the 1st and 2nd fields (Address1 and Address2) are being overlapped for first customer information.

For second customer, the Address2 data is not available from database; hence respective label is also suppressed as per business rule. But the blank row is displayed as marked in the screenshot.

To elaborate more on the above 2 scenarios, here is how the fields are placed:

Say we have a detail section a, where in we are placing the label and the respective data value one beside the other and different fields (Customer Name, Address1, Address2 etc are placed one below the other in same detail a section)

In the second screenshot, the above 2 issues are resolved by displaying each field and respective label under different sections. Here what happens is, when the first field data printing is completed, then only the second section printing starts, hence there won’t be any overlapping.

More explaination on the second screenshot fields placing is here:

For overlapping issue:

We need to create different detail sections (unlike in elaboration for first screenshot where we had placed all fields under single detail section), hence we will create 4 different details sections viz. a, b, c and d to place Customer Name, Address1, Address2 and City in different sections along with respective database field. This, as expalined above will allow to print each field data completely for each detail section and then only next detail section printing will start, which avoids overlapping.

For spacing issue:

Since we placed each field under different sections, we have the liberty of suppressing each section by using section expert. So, we can suppress the entire section for a particular field when the respective database field value is null.

For the second screenshot example, we are checking whether Address2 database field value is null. If it’s null, we are asking to suppress the full section itself. Hence for second customer, the Address2 details are not displayed.

Syntax for suppressing Address2 field is as below (assuming Address2 is the database field)

if isNull(Address2) then true;

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply