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!

counting supressed field problem 2

Status
Not open for further replies.

TheBlondOne

Programmer
May 22, 2001
346
GB
Hi all,
I have created a report that lists student who have a review meeting coming up. The problem is this - for the report to work properly i have had to supress certain records in the details section depending on a certain criteria from the format section tab, this is due to bad database management. The report is bringing back the correct data but my problem starts when i try to count the number of students in the report. The count counts all of the students (including the suppressed ones) does anyone know how to just count the students that are shown on the report. Any help would be great. Thanks in advance.
 
Hi Steve :),

I've tested this formula (used Basic Syntax) and it worked fine.
Note: the field that I used to verify was in the detail line and or it had a valid value or it was null.

Formula:
If IsNull({Mytable.Myfield}) Then
Formula = 0
Else
Formula = 1
End If

I've put this formula in the detail line and used summary to count the valid ones.

Hope it helps!

Luciano Humberto :)I
IT - Support
 
Crystal reports will evaluate supressed records. Although Lurshs' solution works, it may make more sense to use a record selection formula to exclude them from the report altogther. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
dgillz, thanks for replying I have got a lot of it in the select expert, its just down to the users of the database, if they had filled in the relevant fields this report would have been so much easier but because they dont i've run into these problems and the only way that i could get the report to produce the correct data was to use the supress option in the format section. its all a bit messy really but im sure you can aprreciate it makes my job harder. Thanks for your tip though
 
LuRSH,

I'm not sure I understand how this works. I also had to suppress a bunch of lines, but there's nothing null in any of the fields. I want to count the records that are actually displayed on the report (not the suppressed ones). How does your formula above apply?

Thanks!
Jennifer
 
(In Crystal Syntax)

If {Mytable.Myfield} = <Whatever Criteria Makes It Suppressed> Then
0
Else
1

Then Sum this formula.

Naith
 
As dgillz apprpriately suggests, you may elect to limit the records coming in using the record selection criteria (basically put the same thing in there as you use to suppress records), this will speed up the report and allow for displaying and counting everything without worrying over suppression.

Report-Edit Selection Formula->Record

Place your suppression criteria here in the form of:

{MyTable.MyField} <> <suppression criteria>

Something like that, hard to give a great example without understanding the data.

-k kai@informeddatadecisions.com
 
I know how to limit records, I already have a dozen limiting requirements, however because I have 6 linked tables and the way the data is modeled, I couldn't limit this particiular element that way - it's a pretty complex structure. Regardless, Naith's suggestion worked fine for me.

Thanks for everyone's suggestions - I would be lost without this forum!!

Jennifer
 
Hi JennieM:

Just now I've received your post. Sorry for not answering earlier but Naith was around to help you :-D...

Maybe I'll help you another time...

Best regards! Luciano R. Humberto
IT Specialist - Support :)I
The Ryan Companies
 
hi
My formula looks like this
whileprintingrecords;

if {A.Doubtful} = 1 and next({A.DocumentDate}) >= {A.DocumentDate}then 1 else 0

this does not allow summation of the above field..Any suggestions

Regards
Aloma
 
WhilePrintingRecords is stopping you from having your field summed.

You can try the formula without it, or you can use a variable to work in conjunction with WhilePrintingRecords.
Code:
whileprintingrecords;
NumberVar MySum;

if {A.Doubtful} = 1  and next({A.DocumentDate}) >= {A.DocumentDate}then MySum := MySum + 1 else MySum;
Call MySum where you want the total displayed.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top