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

x
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
Medium Priority
6,423 Views
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
Question by:VBBRett
[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
• 2

LVL 101

Accepted Solution

mlmcc earned 2000 total points
ID: 16973755
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
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 101

Expert Comment

ID: 17055385

mlmcc
0

Author Comment

ID: 17056458
Thank you!
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…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
###### Suggested Courses
Course of the Month9 days, 13 hours left to enroll