Crystal- Reports: Exclude a field value from running total - crystal-reports

In crystal reports is how can one exclude a field value from running total. This field is not suppressed however we donot want to add its value to the sum total.

I would suggest you to create one more column for the calculation purpose and then place after the last column and write below formula:
if column="NonDelivery"
then value
else 0
Now take the sum of this column and then place the sum below your mail value column and supress the newly created column.

Related

How to implement a conditional fomula in Crystal Report

I have a table named tblRecovery with 4 column. ID, LStatus, Amount and RecoveredBy I created a formula to sum Amount Column where LStatus Column value is "WCL". I use following code.
It sum all value of Amount column without condition. I want to sum amount column if Lstatus Column value is "WCL". How can I do that?
if {tblRecovery.LStatus}='WCL' then sum({tblRecovery.Amount})
Crystal Reports formulas work on a per-record basis.
Your current formula shows the sum of tblRecovery.Amount on every single row where LStatus='WCL'.
To get the desired result, create a formula-field with following formula and the create a sum of it:
if {tblRecovery.LStatus}='WCL' then
{tblRecovery.Amount}
else
0

Using running totals in formulas - Crystal reports

I have created a set of running totals looking for specific fields in a database.
If these fields are located, a subsequent sum is performed to calculate the total for that field. e.g. Field to Summarise - DB.Field.Value-Sum. Evaluate - Use a Formula-Field Name ='1'
This sums the totals for this field. The issue is that I have many running totals doing this, and what I want to do is add these together to provide a total for all of these. Currently I have a formula that uses each field with a '+' between each. This appeared to work fine, but when tested against a record where some of these fields are blank, the subsequent formula displays nothing.
Any advise on what I should do here/ am doing wrong?
Thanks
It sounds like a null record (empty value) is breaking your running total. You have a few options
Use a formula to check for, and replace a null value with another value (Zero, for example) and then use that formula in your running total calculation
if isnull({Command.Decimal}) then 0 else {Command.Decimal}
Use a SQL expression to replace null with another value Isnull(Tablename.Columnname,0) - use this in your running total
On the running total, under "evaluate" select Use a formula and use this formula not(isnull({tablename.columnname})) -- If the record IS null, the running total does not evaluate it. It will be ignored by the running total.

Crystal Formula that evaluates a boolean field OR field containing not null value

Is there a way to evaluate two fields to count the total number of records that meet the following criteria
Field {NoValidAddress} = False OR Field {Email} = not null
I'm very new to Crystal so I've created a formula field so I've used the following, but this returns the total number of records in the table.
{NoValidAddresses} = false OR not (IsNull({Email})
Thank you for any help that can be given
You can easily count the number of records with values in the email field by using a formula similar to the following:
if not(isnull({Email})) or ({NoValidAddresses} = False) then 1 else 0
Once the formula is created, follow these steps:
Drag the formula onto the report as a field
Right click the field --> Insert --> Summary...
Set "Calculate this summary" to "Summary"
Check the "Add to all group levels" box
Adding the total to all group levels is probably not necessary, but it will show you the total at each group level so that you can determine which one you want to use and suppress/delete the rest.

Crystal Report Sum of a Column data

I have field GrandTotal in my dataset which I am showing in my report. I want show the total of all data in the footer .
My column data are string .
I tried to make a formula as bellow
SUM(ToNumber({Ds.Grandtotal}))
But its saying a field is require.
You must convert the field into number, and then try to get the sum.
Step 1: Create a new formula from field explorer, give a name to formula (relevant name).
Step 2: Convert the field into Number.
Step 3: Then Add Sum of the formula field
Step 4: Place that Formula field into the Report Footer.
Add Formula:
Choose Field to Convert into Number or Currency:
Then After Field Conversion, get the Sum of the Formula field by choosing name of the formula from the Report fields.
Formula field has fx as prefix.
Try below solution.
Create a formula and write formula as
ToNumber({Ds.Grandtotal})
now place this formula in details section.
Now write on the placed formula and click on summary and insert summary to grand total.

Referencing first record in a group in crystal reports

In my report, in group footer, I want to add the sum on a column from all records in the group except the first one. How can I do that?
I tried Insert - Subtotal but it adds all records. If I can access the first record from each group, I can subtract it from the sum.
Let's say you're grouping your report by {Table.GroupID} and want to get the total per group, excluding the first record in the group, for {Table.NumericField}.
You can do this by creating a running total where:
Field to summarize: Table.NumericField; Type of summary: Sum
Set to evaluate with a formula: previous({Table.GroupID})={Table.GroupID}
Reset on change of group
The second step ensures that the group total is updated for every record except the first one in the group and can be read as "Only evaluate this running total when the previous record's GroupID is the same as the current record's GroupID.