Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Crystal cannot sum formula

Posted on 2010-11-10
5
Medium Priority
?
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

722 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