Crystal Reports & SQL Reporting Services Training Consultants
Account Log in:
Username:
Password:
Ambition - The Gospel of Getting On
 
Shaw
Institute of IT Trainers - Freelance Trainer of the Year 2006 & 2009
Liverpool Business Connect Member
  Maximum Impact Solutions Limited - Reporting Solutions, Creating Answers
Reporting Solutions - Creating Answers, Crystal Reports, Dashboarding (Xcelsius) & SQL Reporting Services

The Maximum Impact Solutions Blog Feed ME!!!!

31
March

The MOD function

Designers can use this function to create a banded report, to make list reports easier to read.

The MOD function divides one number by another and returns the remainder.

In this example, the MOD function are being applied to the basic list report in Crystal Reports, and a Table structed report in SQL Server Reporting Services

Below are the MOD formulas, for both Crystal Reports and SQL Server Reporting Services

Crystal Reports:

  1. Right click on the Details section margin
  2. Select the Section Expert menu option
  3. In the Section Expert dialog box, click on the Color tab
  4. Press the Conditional Formating [X-2] button
  5. Enter the following formula:
if RecordNumber mod 2 = 0 then crSilver else crNoColor



SQL Reporting Services:

  1. In the table object, select the Details row
  2. Right click on the selected row, and select Properties
  3. In the BackgroundColor properties enter the following:

    =IIF(RowNumber(Nothing) MOD 2=0, "Snow","WhiteSmoke")
1

Luc

26
May
better to use an incremental index (Crystal Reports), cause record number are not always consecutive... Luc
2

Julia

28
May
I am confused by your comment. The RecordNumber function, is an internal Crystal Reports function that assigns a unique incremental number to each record, starting from 1, returned in the dataset, so I do not see why it would not be consecutive? What do you mean by an incremental index?
3

Jimmie

31
October
I think what Luc is describing are cases where one or more records may be hidden or suppressed. In these cases, the records always get an incremental record number, though it does not show on the report, creating instances where rows would not alternate based on the solution.
4

Julia

01
November
Hi Jimmie, thank you for your comment.

This example was based on a simple list report, where no Details section where hidden/suppressed, using conditional formatting.

But I will add a modified blog post, later this week, as a workaround for the scenario that you are talking about.
5

kavya

14
April
=IIF(RowNumber(Nothing) MOD 2,"Snow","WhiteSmoke") I am getting error while using that formulae
6

Julia

17
June
Hi Kavya,

Thank you for your comment.

The formula is correct, and should not generate and error message.

Where are you applying the formula within the report?

Julia

MAKE A COMMENT

Name *

Email Address *

Comment *

To prove you are human what is:

16 + 40 =