Solved

How do I get a count in Crystal Reports til the report reads all of the records.  I need a loop function in Crystal Reports see inside

Posted on 2006-06-23
3
6,410 Views
Last Modified: 2012-06-22
i am developing a Crystal Report and I want to be able to provide the following function, but I need help writing this function in VB.


groupcountnumber = 0

if( {Command.Status} <> "PRS" or {Command.ACTIONCODE} = "ZDEC" or {Command.ACTIONCODE} = "ZCLO") Then

groupcountnumber = groupcountnumber +1

End If

Formula = groupcountnumber

What I need is for a loop to read through all the records and keep on counting with an increment of 1 as long as the above If statement is accomplished.  I am not sure exactly how to write out this function in VB for Crystal Reports.  Can anybody help?
0
Comment
Question by:VBBRett
  • 2
3 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
Comment Utility
You can't loop through the records in Crystal.  There are several methods to accomplish this.

I like to use running totals
Display the FIELD INSERT popup
Click the RUNNING TOTALS tab
Click NEW (may have to right click)
Name countGroup
Type - Count
Field - Pick one (I tend to use the index field)
Execute - Use a formula
  ( {Command.Status} <> "PRS" or {Command.ACTIONCODE} = "ZDEC" or {Command.ACTIONCODE} = "ZCLO")
Reset - Never (or if this is a group count - on group change)

Put the field in one of the footer sections

Another way is to use formulas
In the report header
Name - DeclVars
Formula
WhilePrintingRecords;
Global NumberVar groupcountnumber := 0;

In the detail section
Name - CountRecords
Formula
WhilePrintingRecords;
Global NumberVar groupcountnumber;

if( {Command.Status} <> "PRS" or {Command.ACTIONCODE} = "ZDEC" or {Command.ACTIONCODE} = "ZCLO") Then
    groupcountnumber = groupcountnumber +1

In the footer
Name - DispCountRecords
Formula
WhilePrintingRecords;
Global NumberVar groupcountnumber;
groupcountnumber

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Glad i could help

mlmcc
0
 

Author Comment

by:VBBRett
Comment Utility
Thank you!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now