Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Convert Crystal Report Expression
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

7 Posts

Posted - 11/17/2013 :  22:46:19  Show Profile  Reply with Quote
I'm converting a Crystal Report into SQL code and need help/direction on how to implement expressions created in the reporting tool in sql code. Below is an expression that returns 1, 2, or 3 depending on how it is evaluated by the run time program. Any assistance in converting this expression into SQL code is appreciated.

Code starts here ***************

if IsNull({WorkAssignment.StartDateTime}) or IsNull({WorkSet.ScheduledReadDate}) then

if (Date({WorkAssignment.StartDateTime}) <= Date({WorkSet.ScheduledReadDate}) and
({WorkAssignment.WorkFilterName} <> 'DNRs' and {WorkAssignment.WorkFilterName} <> 'Type 2s/3s')) or
(val(right({WorkSet.WorkSetID}, 2)) < 50 and mid({WorkSet.WorkSetID}, len({WorkSet.WorkSetID}) - 3, 1) = "0") then

else if (Date({WorkAssignment.StartDateTime}) <= Date({WorkSet.ScheduledReadDate}) and
({WorkAssignment.WorkFilterName} = 'DNRs' or {WorkAssignment.WorkFilterName} = 'Type 2s/3s')) or

((val(right({WorkSet.WorkSetID}, 2)) >= 50 and val(right({WorkSet.WorkSetID}, 2)) <= 69) and
mid({WorkSet.WorkSetID}, len({WorkSet.WorkSetID}) - 3, 1) = "0") then

Code ends here *******************************

The expression is used to group records based on how it is evaluated. Record that belong to group 1 are put into group 1, record that are evaluated as 2 into group two and so on.
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000