Calculating Page Total in Crystal Reports

Posted on 1999-08-01
Medium Priority
Last Modified: 2013-12-25
How to Calculate and Print Page Total in Crystal Reports.
I am using MS Access Database for the Crytal Report.

And also Please send the information, how to make dynamic crystal report using SQL Server.
Question by:Onkar

Expert Comment

ID: 1507350
Actually, you don't need to CALCULATE the total page number as Crystal Report can do it for you. From the menu bar, click Insert => Special Field => Total Page Count Field, and then drag and drop into your report.

If you want to connect SQL Server from Crystal Report, you can use ODBC as a bridge.

Author Comment

ID: 1507351
I want to calculate pagewise total of a column.
Suppose 'Salary' is a column displaying all employes salary, I want pagewise total of this Salary coulumn at end of the page.
LVL 18

Accepted Solution

mdougan earned 200 total points
ID: 1507352
There are a few ways that you might try.  The easiest is to create a formula field, call it something like PageTotal, and give it a formula of Sum({employees.salary}).  Put this formula field in the Page Footer.  This may not work, however, but it is the easiest to try, so I'd give it a shot first.  If it doesn't work, then try:

Create a formula field called @AddSalaryTotal, in the properties for the formula, check the checkbox that says surpressed (this means it wont be visible on the report), then place the formula field somewhere on your detail line.
It keeps a running total for the Page, and for the Report:

The formula for @AddSalaryTotal is:

NumberVar SubTotal;
NumberVar GrandTotal;
SubTotal := SubTotal + {employees.salary};
GrandTotal := GrandTotal + {employees.salary}

Create another formula field called @DisplaySalaryTotal.
In the Page Footer, the following formula displays the subtotal (it is not surpressed):

The formula for @DisplaySalaryTotal is:

NumberVar SubTotal;

Create a third formula called @DisplayGrandTotal.
In the Report Footer, the following formula displays the Grand Total (not surpressed).

The formula for @DisplayGrandTotal is:

NumberVar GrandTotal;

This will definately work, if the first method did not.

As for creating a "dynamic" report under SQL Server, you have to define what you mean by dynamic.  It is easy to create a report where you pass different parameters or change the Selection Criteria, but it is very difficult to change the columns that are selected.  My advice is to create a Stored Procedure to return your data, then create your Crystal Report based on the Stored Procedure, and not the tables themselves.  If you need help on how to pass parameters for a SQL Server Stored Procedure based report let me know.


Expert Comment

ID: 6822785
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.

This is the Community Support link, if help is needed, along with the link to All Topics since many new ones were recently added.

Moderator @ Experts Exchange

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question