Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Crystal cannot sum formula

Posted on 2010-11-10
5
Medium Priority
?
258 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 101

Accepted Solution

by:
mlmcc earned 2000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

886 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