Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Multiple select cases [Solved] Post Reply Post New Topic
Author Message
boweeb
Newbie
Newbie
Avatar

Joined: 22 Apr 2011
Location: United States
Online Status: Offline
Posts: 2
Quote boweeb Replybullet Topic: Multiple select cases [Solved]
     Posted: 22 Apr 2011 at 8:14am
I'm trying to create a report with optional filters. The records have three checkboxes and I'd like to dynamically filter either by their ("Y" or "N") or not at all. I have a static parameter for each containing "Y", "N", and "X" in the value lists with "X" as the default. For testing, I'm using one of each in the parameter prompt. Here's my select expert code:

select {?optMBE}
    case "X" : {APVM.udMBE} like "*"
    default: {APVM.udMBE} = {?optMBE}
 and
select {?optDBE}
    case "X" : {APVM.udDBE} like "*"
    default: {APVM.udDBE} = {?optDBE}
 and
select {?optWBE}
    case "X" : {APVM.udWBE} like "*"
    default: {APVM.udWBE} = {?optWBE}

When I test using optMBE="Y", optDBE="N", and optWBE="X" I'm getting double the expected results.

It's the same when I use the following If's:

If {?optMBE} = "X" Then {APVM.udMBE} like "*" Else {APVM.udMBE} = {?optMBE} and
If {?optDBE} = "X" Then {APVM.udDBE} like "*" Else {APVM.udDBE} = {?optDBE} and
If {?optWBE} = "X" Then {APVM.udWBE} like "*" Else {APVM.udWBE} = {?optWBE}

When I trim my code down to what the selects (or if's) should be evaluating to:

{APVM.udMBE} = {?optMBE} and
{APVM.udDBE} = {?optDBE} and
{APVM.udWBE} like "*"

I get the correct results. Any ideas on why my select/cases aren't working?


Edited by boweeb - 22 Apr 2011 at 10:07am
IP IP Logged
boweeb
Newbie
Newbie
Avatar

Joined: 22 Apr 2011
Location: United States
Online Status: Offline
Posts: 2
Quote boweeb Replybullet Posted: 22 Apr 2011 at 10:06am
I've found another post that gives me a solution that works:

http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=552

Now this code works:

({?optMBE} = 'X' or {APVM.udMBE} = {?optMBE}) and
({?optDBE} = 'X' or {APVM.udDBE} = {?optDBE}) and
({?optWBE} = 'X' or {APVM.udWBE} = {?optWBE})

Though I'm still unsure why my original code didn't work.


Edited by boweeb - 22 Apr 2011 at 10:07am
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum