Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Crystal Reports Where clause in a formula

Posted on 2009-05-08
8
Medium Priority
?
2,704 Views
Last Modified: 2012-08-13
I am trying to write a formula that does a count on a data set with a WHERE clause.  I have 2 columns of data:  NAME and TASKS.  I want to do a count of the NAME WHERE that person has 1 or more TASKS.

I am not sure how to put the WHERE clause into the crystal formula.  Is there another type of function/operators I should be using?
0
Comment
Question by:szadroga
[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
  • 4
  • 3
8 Comments
 
LVL 9

Expert Comment

by:wellhole
ID: 24338078
You should look into creating a subreport and pulling the information from that.
0
 

Author Comment

by:szadroga
ID: 24338133
There is no formula I can write?  
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 24338628
Try this idea
Add a group by Name

In the report header add a formula
WhilePrintingRecords;
Global NumberVar NameCount := 0;
''

In the group header or footer add a formula
WhilePrintingRecords;
Global NumberVar NameCount;
If Count({TaskField},{NameField}) > 0 then
    NameCount := NameCount + 1;
''

In the report footer
WhilePrintingRecords;
Global NumberVar NameCount;
NameCount

mlmcc
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 

Author Comment

by:szadroga
ID: 24338742
I think i have realized my problem, i am trying to a count on a summary field.  I keep getting an error message that this field cannot be summarized.  Is there a way around this?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 24338754
You have to do it manually using a method I outlined.

mlmcc
0
 

Author Comment

by:szadroga
ID: 24338793
When I get to COUNT line, I get the error message because the TaskField is already a formula field.

In the group header or footer add a formula
WhilePrintingRecords;
Global NumberVar NameCount;
If Count({TaskField},{NameField}) > 0 then
    NameCount := NameCount + 1;
0
 

Author Comment

by:szadroga
ID: 24339582
I fixed the summary issue by doing all the summarizing in the SQL query before being brought into Crystal.  But when i insert the two fields into the Count(), i get an error message (see image)
error.jpg
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 24340176
You need to have a group in the report for FullName.

mlmcc
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

604 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