Print Page | Close Window

Multiple Values in CASE

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2863
Printed Date: 11 May 2024 at 5:43pm


Topic: Multiple Values in CASE
Posted By: mikebird
Subject: Multiple Values in CASE
Date Posted: 09 Apr 2008 at 5:52am
Here is my current setup for a parameter:

select {?Client}

case "XNORT01" : "North Lambeth"
case "RLBLH05" : "Hostels"
case "RLBLE01" : "Ethelred"
case "RLETT01" : "Lettings First"
case "RHOLL01" : "Holland Town"
case "RCEDA01" : "Cedars"
case "RCROY01" : "CCHA"
case "RSOUT01" : "Southern"
case "RGALL05" : "Gallions"
case "RPENG01" : "Penge"
case "RSWAN02" : "Swan"
case "RPEAB01" : "Peabody"

// FY 07-08 Client Codes

case "RCROY03" : "CCHA"
case "RPENG03" : "Penge"
case "RSWAN03" : "Swan"
case "RHOST04" : "Hostels"
case "RCEDA02" : "Cedars"
case "RETHE02" : "Ethelred"
case "RHOLL03" : "Holland Town"
case "RLETT02" : "Lettings First"
case "RNORT04" : "North Lambeth"
case "RSOUT10" : "Amicus Horizon Croydon"
case "RWAND01" : "Wandle"
case "YSLFH01" : "SLFHA"
case "YSWAL01" : "Swale"
case "YEAST*" : "East Thames"

All I need to do is edit this script to allow for multiple selections. Is it possible? With the CASE syntax, can I add * in the quotes as if using LIKE or can I do an IN selection ["xyz", "abc"] before the colon? Or do I have to do another CASE line with various contents before the colon, and the same contents after it?

eg.
case "XNORT01" : "North Lambeth"
case "XNORT02" : "North Lambeth"


I want to put all sorts in there which OR into the outcome on the right. These reports have been done better without CASE. Easier to modify this one as it stands

or do I have to write all this without the CASE? I'm happy to if necessary for multiple selections.

Thanks



Replies:
Posted By: jon2ryhme
Date Posted: 09 Apr 2008 at 7:57am
You can do like this one

Select {Customer.Country}
    Case "Canada", "Mexico", "USA":
        "North America"
    Default:
        "Outside North America";


Posted By: jon2ryhme
Date Posted: 09 Apr 2008 at 8:08am

select {?Client}
    Case "XNORT01" ,"XNORT02":
        "North Lambeth"
    Default:
        "Others"

I hope this helps you!



Print Page | Close Window