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

IsNull always returns True

Status
Not open for further replies.

nathj

Programmer
Oct 11, 2004
33
GB
Hi,

I have a report that contains numerous sub-reports, some of which may not have any data to display. According to the Crystal KB I am supposed to set up a variable that determines if there are records and then suppress the relevant section based on that variable. All seems fine. However, when I try this it is not working.

The field tmpChild.ffchild contains 21 yet IsNull() returns True.

Here is the code in question.
If IsNull(Count({tmpChild.FFCHILD})) OR Count({tmpChild.FFCHILD}) = 0 then
SuppressChild:= TRUE
Else
SuppressChild:= FALSE;

The value in tmpchild.FFChild is 21.00. However, IsNull(Count({tmpChild.FFCHILD})) returns True as does IsNull({tmpChild.FFCHILD}).

Any ideas as to how to make this work correctly would be much appreciated.

Many thanks
Nathan Davies
 
You're using isnull(count, not isnull, I'm sure the whitepaper didn't suggest that.

And do you mean "The value in THE COUNT OF tmpchild.FFChild is 21.00"?

Don't mix theories, a count won't be null.

Rather than chat about theory, I suggest that you post SPECIFICALLY what section you are intending to suppress.

Perhaps If IsNull({tmpChild.FFCHILD}) is what you want, or just use the count alone, hard to know from your theoretical posting.

Successful posts tend to include:

Crystal verison
Database/connectivity
Example data
Expected output

Also try to avoid subreports as they tend to slow things down.

-k
 
Hi,

Thanks for stopping by.

I am trying to suppress a details section that contains a sub report if the sub report data is empty. Because of the nature of the report I have to use sub reports.

The problem is, I have since discovered, that count() returns NULL when there is only one record in the table. In my previous example I was saying that the value in the field was 21, the table itself contains only 1 record. Count returns NULL and so IsNull returns True.

I have copied the code from the Crystal KB article. However, I have also come up with a much better solution for this problem. Still using sub reports I intend to use an extra data source that will control the suppression for me. If the report cursor is empty the new control table will set a flag to indicate the section should be suppressed. In this way I can do everything in the program and leave Crystal just for the display.

Thanks for stopping by and thanks for the tips. I didn't know that sub reports slowed things down. Unfortunately in this case there is very little I can do about it but I will bear it in mind for the future.

Many thanks
Nathan

 
I should have said above that I meant to add the required details to my forst post, but forgot, and I could not find the edit function. So just for reference:

I am running a Visual FoxPro 9 app and VFP database. The output tables are converted to fox2x as thats what Crystal will use. I am using version 8.5 of Crystal.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top