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? :-)

ProlabWestAsked:
Who is Participating?
 
wykabryanCommented:
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.
0
 
wykabryanCommented:
Is JobStatus.StatusCode a number/int?  
0
 
mlmccCommented:
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.

mlmcc
0
 
ProlabWestAuthor Commented:
Great input all- thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.