1 Reply Latest reply: Jul 21, 2008 12:35 PM by Falk Liebezeit

# Problem in the SUM() function of Crystal report XI RELEASE 2 Evaluation version

Currently Being Moderated

Hi All,

We have migrated one application from .net 2000 to .net 2005. Now after migration we are facing some problem related to crystal report. The sum function is not working properly. After migration of crystal report 10 to crystal report XI release 2 (though still using evaluation version for testing purpose), the problem is not yet resolved. The problems are described briefly below:

While using the summary in the group field, it is showing the number of rows instead of the sum of the values.

We have checked the same with min-max functions, and it is working properly with those.

We checked the same with average function but in that case it is throwing an error at execution time saying, "The Report Application Server failed".

We have tried to make the sum by formula field. In such case, it is not showing any syntactical error but at execution time, it is throwing an error saying "A number field or currency amount field is required here". Here it is important to make a note that in the report the datatype of the field on which we are applying the sum function, is number, and in the table from where the data is fetched, the datatype is numeric(9,6).

With Regards,

Chayan.

• ###### Re: Problem in the SUM() function of Crystal report XI RELEASE 2 Evaluation version
Currently Being Moderated

Hello,

please see below and extract for the SUM functions from CR Help file with samples

---

Basic and Crystal syntax.

Sum (fld)

Sum (fld, condFld)

Sum (fld, condFld, cond)

Sum (x)

Arguments

fld is any valid database or formula field that can be evaluated by the function.

condFld is a field used to group the values in fld by.

cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.

x is an array of Number or Currency values that can be evaluated by the function being used.

Returns

Number

Action

Enables you to add the values that appear in your report. For example:

If a sales report includes a field that shows the amount of each order, you can compute the sum of all the orders that appear on the report (a grand total sum).

If you break orders into groups (for example, orders grouped by the state that they come from), you can compute the sum of the order amounts per group (in this case, per state).

If you break orders into date or Boolean groups (for example, orders grouped by the month in which they were placed), you can compute the sum of the order amounts per group based on a specific change in the date or Boolean field (in this case, per month).

If you specify a set of individual values, you can also compute the sum of the values in the set. For information on this kind of summary, see Array summary functions.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Sum({file.QTY})

Calculates the sum of all values in the QTY field.

Sum({orders.AMOUNT}, {orders.CUSTOMER ID})

Sums (totals) the orders in each group of orders in the Amount field. The orders are separated into groups whenever the value in the Customer ID field changes.

Sum({orders.AMOUNT}, {orders.DATE}, "monthly") % Sum({orders.AMOUNT })

Groups values in the Amount field by month, and calculates the sum of the values for each month group as a percentage of the sum of the values for the entire report.

Sum([{file.AMOUNT}, {file.PRICE}, {file.COST}])

Sum of values in the Amount, Price, and Cost fields.

Note:    Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see the Evaluation Time.