Limit rows fetched when designing a new report - crystal-reports

Is there a way to limit the number of rows fetched from a table when creating a report with the Report Wizard?
Say I have a table with a million records. I use the report wizard to select this table and some fields. Before I can get to the step where I can use the select expert; Crystal Reports fetches everything record to render on the report. This can take 5 - 10 minutes of just waiting.
Is there some setting to limit how many records can be fetched during design time? Or is there some other approach?

Use a Record Selection Formula
Here is some reference but you may want to google "Crystal Reports Record Selection Formula"
http://www.tek-tips.com/faqs.cfm?fid=3826

A simple setting can limit the records!! Here it is, if you're using .Net 1.1 (similar set of options in higher frameworks too!).
Solution 1: Right click on the report layout > Reports > Top N/Sort Group Expert > Choose Top N in the Dropdown that asks for the type of filtering/ sorting you wish to do > Set the Value of top N (100 for ex.) > Uncheck the option that includes other records. You report will be filtered for only the top N records from the Dataset.
Solution 2: Using the Record selection formula where you limit the No. of records on a particular Report/Sub report. Right click on the report layout > Reports > Record Selection Formula > Enter the formula as "RecordNumber <= N". That's it. The number of records fetched from the Datasource will be only upto N.
Cheers!

Related

How to filter records in a single section of Crystal Reports

I have my base record set filtered with a parameter. However, this leaves me with 6 records and I need to filter down to one particular record in each of my sections. If none of the records meet my criteria i cannot suppress the section, it will need to just stay there and blank.
Essentially, I need a method to filter down records that hit one of my sections but not affect the report as a whole.
A few notes:
I cannot use a subreport for this. I need to duplicate this effort over a couple of sections and if I add any more sub reports it just crashes crystal reports (I have a lot of data & a ticket with SAP)
Using a suppression formula hasn't worked yet because I need the section to exist, if it has a null value
Applying no filter doesn't help me because it will duplicate my section 6 times
2 options.
a)
Right Click on white space and choose Insert Group
Choose your field and select specified order or use another record that can filter your data
On the Specified Order Tab click New
Select equal to on the combo box and specified what record you need to be shown
or
b)
Right click on the record
Next to the suppress check box, click on x-2
Here you can create a formula to suppress the records that you don't need.

Modifying a report to remove a record limit?

I'm trying to modify a report that shows the Top 10 Customers by Sales. Currently, the report shows the top 10 customers, and stops.
I'm trying to remove the limit of 10, so I can see all customers sales data. I can't find where the report is setting this limit. I've looked through the formula editor, and can't find any relevant formulas to this limit.
Also there are no suppression formulas.
Any ideas?
Found the answer.
Under the Report > Group Sort Expert menu, I was able to select between:
No Sort
All
Top N
Bottom N
Top Percentage
Bottom Percentage
for the group sort. I selected All, and now all my records are showing.

Crystal Reports Record Selection and Summary Field conflict

I am really new to Crystal Reports and I am looking for any suggestions on how to approach the following issue:
I currently have a report that uses a record selection to limit the results by date. I would like to include in this same report a summary a total count of all the records (ignoring the record restriction). Unfortunately (although somewhat expected), the summary calculates the total after the record restriction is applied. Is there any way to get around this? In case my question is a bit unclear I've included a generic example below:
I have a report that pulls info from a database with a total of 10 records.
I select a specific date range, and it only returns 3 records
I would like to include in the report footer that 3/10 records are getting returned.
This is bit tricky to perform in crystal reports as record selection is compulsory applied. However you can overcome this by using sub report.
Calculate the report footer using report.
This will surely work

Crystal Reports Xi - Sorting a CrossTab Report by a Summary Field

So I have a simple crosstab report that calculates number of sales in the columns, and the rows are each office. The last column on the right is a total column, which contains a summary field (via a count of the identity field) that adds up the total number of sales per office.
How can I sort the crosstab data so the office with the most sales is the top row, and the rest in order under it?
Try this: Right-click on the crosstab. Go into the Group Sort Expert menu. There you will see options to display the top N rows, Sort All by the aggregate of a field of your choice, etc.
(I'm using Crystal XI. If your version is different, this may not work exactly)

Crystal Report-Running Total

I have a problem with running Total in Crsystal report9
if their is no values available for a Paticular field how can we return the running total as '0'
Instead of display the Running Total directly in your report create a Formula Field based on the Running Total and drag it into the report.
Your formula should look like this (Crystal Syntax)...
if ISNULL({#RunningTotalField}) then
"0.00"
else
ToText(RunningTotalField, 2)
If there is no data for that particular group, then Crystal won't show it easily. Your options are :
1) Use subreports to display the values for a particular group, and keep the main report just looking at the table(s) containing the group headers.
2) Use a stored procedure as the source so you have full control over the SQL that is run.
The problem is that as soon as you use a field to group, Crystal will only return records where that field has been used. If it was simply in the Details section you could modify the link to a LEFT JOIN and it wouldn't matter, but the group forces the INNER JOIN which means the groups without data are not returned.
Unfortunately Running Totals don't show up if there are no records that match your criteria. An alternative is to use a set of formulas calculated in various sections of the report. The technique is widely described in the Crystal literature. For example, this TekTips gives a very succinct overview of your options.
You set up an initialising formula in each header, with the evaluation time directive "WhilePrintingRecords". This approach was the only one available for doing running totals in the "good ol' days" before RunningTotal objects were available.