Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

forcing a group to display

Status
Not open for further replies.

kobe

Programmer
Feb 5, 2001
5
US
Hello !
Is there anyway to force a group to print on a report.
I have written a report that has a one to many relationship.
the report prints from a salesman file, groups by salesman id, and print out all records form a sales order file. Using the above the reports runs fine, that is all groups print out even if there are no sales orders for that particular salesman. I have since added a date range parameter to the report and the reports selects the correct sales orders by date and totals the correct information but now the groups that did display that had no detail for them no longer appear. The groups are not being supressed in any way and I am at a loss to solve this problem.
I am using crystal reports version 8.0 build 3.00.85.

Thank you for any insight you may be able to provide.
Kobe :)
 
Crystal will only print a group if there is at least one record. Before you probably had an outerjoin, which meant that if a group didn't have any detail matches, it would maintain one record with null detail fields.

Now you are saying that the date has to be in the range. The null date no longer meets the criteria, and so it is rejected. Now there are no records for that group in the results, and it doesn't print.

You could use linked subreport to print the orders instead of a join. This is slower, but you will at least get the salesman list to be complete.
Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Ken:

Thank you for your prompt response, However I think I nedd to clarify the situation a little more. The type of data base we are using is pervasive SQL version 7.5 with Macola Accounting software, So I am not using any kind of OBDC connection or schema file. The files are .DDF types and they are acessed directly in crystal reports 8 I did however create a data dictionary as follows.
The Data Dictionary contains 2 files the main file I am sorting on is the salesperson file, I am only using 2 fields.
SLM_NO
SLM_NAME
The Second file has a salesman number and some amount fields.
I have tried making a subreport that is linked to the salesperson file but it gave me erronius results. So I was wondering is there a way to either print a blank line If I have a salesperson that has no orders or is there a way to test for this condition so that I can force all zero's or somting like that. I have tried checking for null fields at both detail and group subtotal time but to no avail. At what point does crw check if the record you are reading is on file?

Thanks Kobe
 
Kobe,

You are using Btrieve, which is a Crystal "Datafile" connection that does not use ODBC or SQL. In this environment, all joins will behave like an SQL outer join, you have no options. So, you get the exact same behavior that I described above. Crystal doesn't read the records in the two tables separately. It makes a combined table from both by linking matching records. It then evaluates each record in this combined table to see if it is in the date range. If all matches are outside the date range, there isn't a record left to print.

Linked subreports are the solution in this situation. They will work if done correctly.
What was your error?

Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Kobe:
Have you found a solution to this problem yet? I am having the exact same problem and have not found a satisfactory solution. I have created a report that has a one to many relationship. The report prints from an "Apartment" file, groups by "ApartmentID", and prints out all records form a
"Resident" file. The report runs fine, it prints all apartment numbers out even if there are no residents for that apartment. However, when I add a date range parameter to the report and the report selects the correct "Residents" by date it no longer displays the "ApartmentID" for the records without residents.

Please let me know if you have found a solution.

Thanks,
Precious
 
The first situation only works because the apartment with no residents generates one record with blank resident information. Nothing prevents this record from being included, even though it has a blank date.

However, when you add the date range criteria, this record is excluded because it's date doesn't qualify. And that eliminates all records for that apartment.

The solution is to create the main report for the apartment info only, and then to create a separate report for the residents' info. You then insert the second report into the first as a subreport, and link the apartment ID from the main to the sub report. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top