• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 846
  • Last Modified:

Need to limit Crystal Reports related table selection to only one record. I'm new to this app.

Ok, formulating this question may be difficult for me.

I have a mostly working report in which all data is keyed off of a field called JobN and one master table called OpenJob.  There are several related tables, all linked by JobN.  One of those tables, named JobStatus, has many rows with the same JobN.  

When I run the report, what I WANT is one row per JobN, with data in each column as I've defined, and the maximum value of Jobstatus.StatusCode for any given JobN from the linked JobStatus table.

What I GET is multiple rows for each JobN- one for every occurence of JobN in that linked JobStatus table.

In straight SQL, I might be able to say, SELECT .... max(JobStatus.StatusCode) but I apparently can't edit a SQL statement directly in CR.

Any ideas?  Does the above make sense at all? :-)

  • 2
1 Solution
Is JobStatus.StatusCode a number/int?  
Try this

Add a group to the report to group on JobN
Add a Sort on the JobStatus
In the group footer put your field for the report.

The detail section will be empty.

Provided StatusCode is a number the following will work.

Create a group on JobN.  Then Right Click on the StatusCode, Go to Insert>Summary.  
A box will appear (Insert Summary), the first section should have your StatusCode column name in it.  If it doesnt, pull the drop down and find your column.  Then the second section is Calculate this summary, in the drop down choose Maximum.  The final section is Summary Location (where do you want the summary to appear), choose Group #1.

So your report will look something like this:

GH1 - JobN
Detail - Suppress(to suppress, right click on the Section Name; Detail, and choose suppress)
GF1 - JobN, Maximum([StatusCode])

Hope this helps.
ProlabWestAuthor Commented:
Great input all- thank you.

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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now