×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to retrieve all data including NULL with the CASE statement?

How to retrieve all data including NULL with the CASE statement?

How to retrieve all data including NULL with the CASE statement?

(OP)
I have a parameter field that will allow user to specify the vendor and I also have them put ALL to select the all VendorID include those with NULL values. However when user type in ALL it did not return any value in the report? There are 3 tables joined and below is my  Edit Selection Formula-Record. Please advise. Thanks.

---@VendorID is a formula with the value {PRODUCT.VENDOR}

---------Edit Selection Formula-Record------------

select {?VendorID}  --->from the parameter field


Case {?VendorID}:({@VendorID} = {?VendorID})

Case "ALL":({@Vendor}={PRODUCT.VENDOR})

---------Edit Selection Formula-Record------------

RE: How to retrieve all data including NULL with the CASE statement?

Try:

(
if {?VendorID} <> "ALL" then
{@VendorID} = {?VendorID}
else
if {?VendorID} = "ALL" then
true
)

I see that you're using a formula and NOT a database field. This may result in the record selection formula not being properly passed as SQL, so check the Database->Show SQL Query.

You may have better luck by using a SQL Expression instead of a formula, Crystal will pass SQL Expression references well.

-k

RE: How to retrieve all data including NULL with the CASE statement?

(OP)
I am using Crystal v8.0 does this version comes with SQL expression? If yes, Where can I find it. Thanks.

RE: How to retrieve all data including NULL with the CASE statement?

(OP)
How about how would you do 2 parameters with 2 conditions and one condition is selective and the other is ALL or vice versa.Example below.THanks.



if {?Itemid} <> "ALL" and {?WhseID} <> "ALL" then
{@itemid} = {?Itemid} and {@WhseID} = {?WhseID}

Else
if{@itemid} = {?Itemid} and {?WhseID} <> "ALL" then
{@itemid} = {?Itemid} and {@WhseID} = "ALL"   ----????

RE: How to retrieve all data including NULL with the CASE statement?

Perhaps you could include what's in the formula, as previously requested?

To add in a second parameter, do it all again:

(
if {?VendorID} <> "ALL" then
{@VendorID} = {?VendorID}
else
if {?VendorID} = "ALL" then
true
)
and
(
if {?ItemID} <> "ALL" then
{@ItemID} = {?ItemID}
else
if {?ItemID} = "ALL" then
true
)

You're missing the point of this, which is to ensure SQL Pass through.

You might have a look at my FAQ as well:

FAQ767-3825

-k

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close