10 February 2012

Crystal Reports - How to Force Page Break On Rows Count

I have a report that I am designing that requires that a new page be generated if rows has more than 8 then second page needs to be generated. To do that follow the steps.
Step 1:  Create a formula to get the rows count for that select field explorer and then expand the formula fields. 

Step 2:  Right click on Forumla Fields and select New to create a formula.  It will show a popup window then enter formula name and "Use Editor" as show bellow.
Step 3:  When click on Use Editor button it will show Formula Editor window.  Here you will write the condition to get rows count as shown bellow. Drag and drop the field.


The Formula Would be:
ToNumber({REP.TotalEmps})

Step 4:  You have created  a formula and use it in the report for page break if rows count increases as per your requirement. Right-click on the Group Header in the Design tab, select "Section Expert" as shown below and then it will show Section Expert window.

 Step 5:  From the section Expert window Select the "New Page After" checkbox and click on the formula edit button then it will show a window to write formula as show bellow and click on save and close.

The formula says that when the employee count greater than 8 then remaining records will be print in the next page. Based on your requirement change the count value.

No comments:

Post a Comment