If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Crystal Reports > Select Case Wildcard

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: May 2003
Location: UK
Posts: 233
Select Case Wildcard

I am using the following code, using Basic Syntax. I want to use a wildcard in the code. Ie 5641****, 5642*** etc. Does anyone know if you can use a wildcard in a Select Case Statement and if so how is this done?

Select Case ({@Expense Code})

Case "56410000", "56420000", "56430000", "56440000", "56450000", "56460000", _
"56580000", "56360000", "56370000", "56380000", "56390000", "56560000", _
"56570000", "56580000", "56590000", "56410000", "56520000", "56530000"
formula = "Admin & Clerical"

Case "58330000", "5833NP09", "5833NP11", "5833NP12", "58350000"
formula = "Admin & Clerical Agency"

End Select
Reply With Quote
  #2 (permalink)  
Old
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,885
I dno't believe CASE works with LIKE comparisons... You may have to resort to if/else if statements instead
Code:
If {@Expense Code} Like "5641%" Then
  formula = "Admin & Clerical"
Else If {@Expense Code} Like "5833%" Then
  formula...
End If
Orrr.... You could compare the first 4 characters of the code (if that suits your requirements)
Code:
SELECT CASE Left({@Expense Code}, 4)
  Case "5641" ....
__________________
George
Home | Blog
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: May 2003
Location: UK
Posts: 233
The If Then Else Statement would prove really really long. However taking the first 4 characters should be spot on.

Many thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On