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

Use "SELECT CASE" in Record Selection? 1

Status
Not open for further replies.

RustyAfro

Programmer
Jan 12, 2005
332
US
Hello,

Referencing this thread: thread767-1188112

Instead of using OR statements, is there a way to use Select Case statements? I cannot get it to work (the End in the End Select is black instead of blue). I have several of the date ranges I want insert and just want it easier to read/follow.

Code:
(
{?dateperiod} = "Last7Days" and
{table.date} in Last7Days
) or
(
{?dateperiod} = "LastFullMonth" and
{table.date} in LastFullMonth
)
 
Doubt it will be much easier, and Crystal may not pass the criteria to the database as a result of doing so.

The latter being the real fear.

-k
 
Why do you WANT to use a select case statement instead of using "or's"? If you wanted to do the above in a case statement, it would look like:

(
select {?dateperiod}
case "Last7Days": {table.date} in Last7Days
case "LastFullMonth": {table.date} in LastFullMonth
)

You don't have to add "end" at the end.

-LB
 
Lbass,

For no other reason than I like Case statements :). I'll try this and make sure it passes to the database. If it does, I'll use this method. Thanks for your time as always!

Joel
 
It does pass to the database and looks a lot cleaner.

Thanks!!

Joel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top