Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Mimic MSSQL Statement in Crystal XI Post Reply Post New Topic
Author Message
slingboy
Newbie
Newbie
Avatar

Joined: 16 Jul 2008
Location: United States
Online Status: Offline
Posts: 1
Quote slingboy Replybullet Topic: Mimic MSSQL Statement in Crystal XI
    Posted: 16 Jul 2008 at 12:42pm
I am able to create the recordset I need in MSSQL using the following statement:
------------------------------------------------------
 SELECT
CounterJobTaskDetail.JobItem,
CounterJobTaskDetail.TaskCode,
EstimBinderySpoils.ActivitySpoiPercent,
EstimBinderySpoils.ActivityMRSpoils,
CounterJobTaskDetail.CJobNumber
 FROM  
CounterJobTaskDetail,EstimBinderySpoils
 WHERE 
CASE when CHARINDEX('X',CounterJobTaskDetail.TaskCode) > 0 then LEFT(CounterJobTaskDetail.TaskCode,CHARINDEX('X',CounterJobTaskDetail.TaskCode) - 1) else CounterJobTaskDetail.TaskCode end = EstimBinderySpoils.ActivityMiscKey AND
CounterJobTaskDetail.CJobNumber = '138251';
------------------------------------------------------------

How can I cause Crystal to use a statement like this? Please notice the CASE statement in the WHERE clause.

Thanks.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 23 Jul 2008 at 1:25pm
In order to use the Case statement, you'll have to use a Command in your report instead of the tables.  A Command allows you to enter your own SQL.  If any of the values in the where clause come from parameters, replace them in your SQL using the Crystal {?ParameterName} syntax.
 
-Dell
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.