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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Proc returns null, won't compile

Status
Not open for further replies.

Zarobi

Technical User
Feb 19, 2004
13
US
Using CRv9. One of my subreports calls a stored procedure that returns three values for a given customer ID (only one of which I'm actually using). If the customer did not participate in a promotion that month, the values are returned as NULL. I've spoken with the SQL programmer and she assures me that due to the complexity of the query, she is unable to return zero values instead of nulls.

If I run the report for a customer that has participated in the promotion, everything works nicely. However, if I run the report for a customer who has not participated, Crystal tells me that "One or more fields could not be found in the result set. Use Verify Database to update the report." I verify the database successfully, but continue to get this same error.

I have tried using a simple formula to handle the null value. This formula is the only object used in the subreport. It successfully displays a value for participating customers.

if isnull({PromoTotal}) then nPromo := 0
else nPromo := {PromoTotal};

I could run the report separately for customers who have participated, and then remove the subreport and run the rest. However, we're looking at 3000 customer reports that have to be collated later with additional material, and their alphabetical order is of importance. Separating them into different batches will complicate things later.

Any suggestions are greatly appreciated.
 
EDIT: It turns out that the stored proc is NOT returning null values. In fact, it is returning nothing for non-participants. Which explains why Crystal can't find the result set.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top