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,417 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
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 100

Expert Comment

by:mlmcc
ID: 17055385
Glad i could help

mlmcc
0
 

Author Comment

by:VBBRett
ID: 17056458
Thank you!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 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