Mirza Bilal
Mirza Bilal

Reputation: 551

Increment parameter field after 10 pages Crystal Reports

I am new to Crystal Reports. I have created a parameter field name countParam and added it in my report header. The countParam is initialized from my vb.net code For Example I initialized it to 50.

Now when I display the report, the countParam shows 50 value in the report header and repeats this value in all pages.

I want to know how can I increment it to 51 after 10 pages. For Example from Page 1 to 10 the countParam displays 50 and from page 11 to 20 it displays 51 and then from 21 to 30 it displays 52 and so on...

I have figured out that If I add PageNumber to it, it will successfully increment by one after each page, that is 51,51,52. However I don't want this. I want it to inrement after 10 pages. Anyone can guide me how can I achieve my task. I will be thankful.

PS : I am using Crystal Reports 2010

Upvotes: 2

Views: 717

Answers (2)

Rizwan606
Rizwan606

Reputation: 667

You can use the following formula:

{?countParam} + Int ((PageNumber / 10))

Upvotes: 2

Ajay2707
Ajay2707

Reputation: 5808

I give you idea about this.

Create a local variable and put in your header where you want to print. In variable field, add formula which increment whenever page count goes multiply of 10 i.e.

//right now I do not know the syntax, please correct it
numbervar iCount = 0 ;    // Initialization
if ( iCount < countParam )   //this set 50
   {iCount := iCount + 1;}
elseif ( (iCount > countParam) && ( countParam < @@PageNumber ) && ( @@PageNumber % 10 < iCount  - countParam) )   //this will increment if goes to beyond 
   {iCount := iCount + 1;}
return iCount; 

Upvotes: 1

Related Questions