Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

putting sum count in report header 1

Status
Not open for further replies.

kieso

Technical User
Jan 29, 2003
45
US
I keep getting the following error when I try to add a condition to my count function
The summary/Running Total field could not be created
A Group Condition is not allowed here


current count works fine
count ({LOCATION.DESCRIPTION},{@within window new})

example of new count that won't work
count ({LOCATION.DESCRIPTION},{@within window new}, "No Data")

where {LOCATION.DEESCRIPTION} is a String, and @within window new =
if IsNull ({@act_hr:mn}) then &quot;No Data&quot; else (if IsNull ({@TW1open}) then &quot;No TW&quot; else (if {@act_hr:mn} < {@TW1open} then &quot;Early&quot; else (if (({@act_hr:mn} > {@TW1open}) and ({@act_hr:mn} < {@TW1 close})) then &quot; Ontime&quot; else (if IsNull ({@TW2 open}) then &quot;Late&quot; else ((if (({@act_hr:mn} > {@TW2 open}) and ({@act_hr:mn} < {@TW2 close})) then &quot; Ontime&quot; else ((if (({@act_hr:mn} > {@TW1 close}) and ({@act_hr:mn} < {@TW2 open})) then &quot;Between TW&quot; else &quot;Unknown&quot;))))))))


it's probably something really dumb, but help me out, will ya?

:eek:)
 
I have never seen a formula like your second one. Here is how I would do it:

Create a formula:
if {@within window new}=&quot;No Data&quot; then 1 else 0

Then sum this formula. Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
I think the problem is that in the Crystal function list it shows an argument called &quot;condition&quot;. This is a misleading name because the argument is not a boolean condition. It is a group condition like the word &quot;weekly&quot; for date groups. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
My second formula is used to create groups. As such, Ken, yes the condition I'm using is also a group name, derived from this formula.

Here's my stupid Question for the week (and it's only Monday!!!) Am I precluded from using a group name as a condition in a formula??

Rodger
 
Your group field can be the second &quot;condition field&quot; argument in the formula, making your formula use the group total.

However, the third &quot;condition&quot; argument only applies to date groups. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
&quot;However, the third &quot;condition&quot; argument only applies to date groups.&quot;

What if the formula is NOT used to identify each group. Can I use stuff other than a date, then? Can I use a &quot;string&quot; for the condition of a count or sum function?

If so, then all I should need to do is create another identical formula, like my second one noted in my origional post, that applies one of six strings to each record, then apply a conditional sum to that. Will that work, or are these conditional fields strictly limited to date, regardless of whether or not they define a group?

Alternatively, dgillz, I guess I can do it your way. If I do that though, with 6 different fields that I want in the report header, than I'd make a &quot; if &quot;xx&quot; then 1 else 0 &quot; statement for each of the six possibilities, and sum each individually ... right

Rodger
 
No, you can't put logical conditions inside the summary functions. You might want to read the Crystal &quot;Help&quot; on the SUM function for a more detailed explanation of what that 'condition' argument is used for.

Use Dgillz technique, or see faq149-243 for the different ways to do conditional totals. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top