Print Page | Close Window

Problem displaying field values

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=21619
Printed Date: 03 May 2024 at 10:30pm


Topic: Problem displaying field values
Posted By: rmdalrk
Subject: Problem displaying field values
Date Posted: 27 Jul 2015 at 11:04am
I'm working on a report and running into a problem that I've encountered multiple times in the past but haven't found a solution for.

I have two tables.  The first table is a customer master table and the second is an invoice master table.  I've linked the two tables together using the customer_id fields.  The problem I'm running into is when I filter the invoices by date or some other parameter using the select expert.  If there are no invoices that match the parameters, no invoices are displayed, as expected.  However, I need to still be able to display values from the fields in the customer master table, such as customer_id, customer_name, etc. in the report header.  When no invoices are displayed, I'm unable to display customer information in the report header. I'm selecting the customer_id using a parameter.

Thanks for reading.



Replies:
Posted By: DBlank
Date Posted: 27 Jul 2015 at 11:20am
for a single customer invoice I think people often handle it by running the 'invoice' data as a subreport. This way your selection criteria allows for the customer data to still pull into the main report.
If you can create a stored proc as your data source (or a crystal command) you can move the date range criteria out of the WHERE and into the LEFT JOIN

example:
select c.customerid, c.fname, c.lname, i.* from customers c
LEFT JOIN invoices i on i.customerid = c.customerid and i.date between @start and @end
WHERE c.customerid = @customerid



Print Page | Close Window