Solved

Crystal cannot sum formula

Posted on 2010-11-10
5
245 Views
Last Modified: 2012-05-10
IF {Z_MEV_MONTH.ComponentItemNumber} = "120001" Then
((({Z_MEV_MONTH.NewProduction}* 0.47) - ({Z_MEV_MONTH.DeltINV}* -1)) * 0.26)
Else If  {Z_MEV_MONTH.ComponentItemNumber} = "81009" Then
((((({Z_MEV_MONTH.DeltINV}/({@Total ASA}*0.3) * 0.6411) * {Z_MEV_MONTH.NewProduction})*-1) - ({Z_MEV_MONTH.DeltINV}* -1)) * .311)
Else If {Z_MEV_MONTH.ComponentItemNumber} = "81010" Then
((((({Z_MEV_MONTH.DeltINV}/({@Total ASA}*0.3) * 0.6411) * {Z_MEV_MONTH.NewProduction})*-1) - ({Z_MEV_MONTH.DeltINV}* -1)) * .311)

Will not sum
0
Comment
Question by:jessebrannen
5 Comments
 
LVL 9

Expert Comment

by:wellhole
ID: 34104017
Make sure that the values in your maths are all numeric. Crystal may have trouble if any value it reads is null. Either goto the file menu and set all database nulls to default values, or catch these suckers and handle them.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 34104111
I suspect the problem is this formula field
{@Total ASA}
Judging from the name it looks like this might be doing a calculation across multiple records.
If so then it probably can't be used in a formula which is summed.

You  would have to use variables and build your own sum as you go.
0
 

Author Comment

by:jessebrannen
ID: 34104556
having trouble with variables

Whileprintingrecords;

Global CurrencyVar Tot;

Tot = Tot + IF {Z_MEV_MONTH.ComponentItemNumber} = "120001" Then
((({Z_MEV_MONTH.NewProduction}* 0.47) - ({Z_MEV_MONTH.DeltINV}* -1)) * 0.26)
Else If  {Z_MEV_MONTH.ComponentItemNumber} = "81009" Then
((((({Z_MEV_MONTH.DeltINV}/({@Total ASA}*0.3) * 0.6411) * {Z_MEV_MONTH.NewProduction})*-1) - ({Z_MEV_MONTH.DeltINV}* -1)) * .311)
Else If {Z_MEV_MONTH.ComponentItemNumber} = "81010" Then
((((({Z_MEV_MONTH.DeltINV}/({@Total ASA}*0.3) * 0.6411) * {Z_MEV_MONTH.NewProduction})*-1) - ({Z_MEV_MONTH.DeltINV}* -1)) * .311)

just returns True or False???
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 34105739
You are in Crystal syntax for the formula. Assignment is done with :=. The = is used for comparison

Change the first line to
Tot := Tot + IF {Z_MEV_MONTH.ComponentItemNumber} = "120001" Then

mlmcc
0
 

Author Comment

by:jessebrannen
ID: 34106553
Thank you!!!! Syntax, sytax, syntax.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Encrypting SQL Server 2014 or SQL Server 2016 4 30
SSMS Opening Mode 9 20
Crystal Report - Charts 4 16
Run Stored Procedure uisng ADO 5 23
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

820 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