SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

tupacmoche
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
(
3
)

else
(
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
1

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
2
else
3
;
)
;

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  
 New 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.04 seconds. Powered By: Snitz Forums 2000