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

creating a derived field using case

Status
Not open for further replies.

rougex

Technical User
Nov 7, 2006
19
US
HELP! - SQL -
Running Reportsmith 3.1 (linking to ADP Enterprise) to create a Compliance report for Workers Comp Reporting. I am trying to translate data to do the following
When '0' then ' ' (nothing) - or it can be '0'
when greater than '0' then '1'
I cant get it to accept any comparison expressions. Please assist if you can.
 
CASE WHEN (INJURY.RESTRICTD_WORKDAYS) > 0 THEN '1' ELSE ' ' END

Through trial and error I was able to work through it with the above.
 
I've found that having the word "WHEN" before the name of the field being compared seems to work.

Some case statements allow you to identify the field name then enter "when "25" then", but not the comparison fields.

ReportSmith: It are Touchy !
 
You could also use DECODE

DECODE(field name,0,0,1)

This will evalulate like this:

If field name = 0 Then
0
Else
1
End If

CharlesCook.com
Specializing in ReportSmith Training and Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top