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

Filtering out records based on parameter and date 1

Status
Not open for further replies.

DeafBug

Programmer
Jul 31, 2003
47
US
I have a report that clients can choose to display items that were sold with warranties. One of the parameters is "IncludeLifetime" as some warranties are lifetime. If a warranty is lifetime then the expiration date field of that record is null. If a warranty is not lifetime then the expiration date is populated (to end at some point.)

In VB, there is a checkbox for the clients to check if they want the report to display lifetime warranties or not. I passed the boolean value to CR parameter called IncludeLifetime.

In CR, I have the code, in Report |Edit Selection Formula | Record, as this

{?IncludeLifeTime} and isNull({Warranty.ExpirationDate})

It doesn't work as expected, it either filters all the records or it doesn't. But I can't think any other place or how to make the formula work.

For example, if there are 4 records and only two records are have Null as expiration date (lifetime), I expect to see all 4 records if the IncludeLifetime parameter is true, otherwise I expect to see only two records.

BTW, I am using VB6 and CR7.

Thanks.
 
This works with CR 8.5, and passes to the server as part of the WHERE clause:
[tt]
If Not {?IncludeLifeTime} Then
Not IsNull({Warranty.ExpirationDate})
Else If {?IncludeLifeTime} Then True
[/tt]
-dave
 
Hey, it works! I copied your code and pasted it. It seems to do the job. I still need to do in-depth testing.

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top