?
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
Medium Priority
?
6,422 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
[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
  • 2
3 Comments
 
LVL 101

Accepted Solution

by:
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
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 101

Expert Comment

by:mlmcc
ID: 17055385
Glad i could help

mlmcc
0
 

Author Comment

by:VBBRett
ID: 17056458
Thank you!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

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…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

762 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