[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
Solved

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

Posted on 2010-01-05
Medium Priority
1,365 Views
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
Question by:dking_wri

Expert Comment

ID: 26186666
Would this work;

If {field}="Y" Then
Sum({amount})
Else
0;
0

LVL 35

Expert Comment

ID: 26187428
Create a formula with

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

You should be able to use Sum on that formula.

James
0

LVL 16

Expert Comment

ID: 26190104
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

Author Comment

ID: 26190332
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

LVL 35

Accepted Solution

James0628 earned 1500 total points
ID: 26192227
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

Author Closing Comment

ID: 31673256
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

LVL 35

Expert Comment

ID: 26192444
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

Featured Post

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month19 days, 18 hours left to enroll