• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1540
  • Last Modified:

How can I get around the "A field is required here" in Crystal XI

For flexibility I'm trying to include an If Then Else statement inside a sum() function but I'm getting the error message: "A field is required here". Any tricks on how I can get around this? Sometimes I use totext() or tonumber() to get around similar error messages.

Here is my example:
sum (
if {field} = "Y"
then {amount}
else 0
        )

Thanks!
David
0
dking_wri
Asked:
dking_wri
1 Solution
 
ansvaritCommented:
Would this work;

If {field}="Y" Then
  Sum({amount})
Else
  0;
0
 
James0628Commented:
Create a formula with

if {field} = "Y"
then {amount}
else 0


 You should be able to use Sum on that formula.

 James
0
 
wykabryanCommented:
yeah, james's solution is correct. Make sure that you put it in the detail line so that you can right click and insert summary.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
dking_wriAuthor Commented:
Thanks for your comments. I was trying to avoid using a summary object and thought that there might be a trick to get around this in a single formula. I need to create a second formula that tests for a "N" value and thought I could just duplicate and modify the formula as opposed to creating 4 objects ( two formulas and two summaries)
0
 
James0628Commented:
Two formulas and two summaries don't seem like that big a deal, and I'm not sure exactly what you're trying to do, but you could also consider using running totals.  Maybe they'd better suit your needs.  For example, for your original problem, you could create a running total on {amount} and set it to evaluate when {field} = "Y".

 James
0
 
dking_wriAuthor Commented:
Hello James,
You are correct that two formulas and two summaries is not a big deal but I need to then replicate this process across 50 different objects which creates a 100 new formulas in my report. I was trying to minimize this number. I'll also try the running totals as you suggested. Thanks for your help!
0
 
James0628Commented:
I thought there might be more to it than just 2 formulas and summaries, but, of course, had no way to be sure.  I'm afraid you may just be stuck with having to create a lot of different objects.  FWIW, you can do things like copy the contents of one formula and paste them into another, which may help a little.

 James
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now