COGNOiSe.com - The IBM Cognos Community

ETL, App Development and other tools => COGNOS DecisionStream/Data Manager => Topic started by: elkoreano85 on 08 Apr 2008 12:59:21 PM

Title: Case Statements
Post by: elkoreano85 on 08 Apr 2008 12:59:21 PM
I need help in creating a case statement for a derivation. The syntax DM shows is as follows:

case <expression> of
begin
<value1>: <block>
default: <block>
end


I am actually nesting it in an IF/ELSE statement therefore it looks something like this:

If (TIME_SID > 20071230 AND SUBSTR(COMPANY_CD, 1, 3) = '076') Then
   Case (MATERIAL_CAT2_CD) Of
             Begin
   '010': 0.001
             '040': 0.067
   '020': 0.032
   Default: 0.093
   End
Else If (TIME_SID < 20040126 AND SUBSTR(COMPANY_CD, 1, 3) = '076') Then
0.0465
Else
0
End If


But I get this error:

1. ERROR
DS-EXP-E001: Expression parse error at position 127;
unexpected token

If (TIME_SID > 20071230 AND SUBSTR(COMPANY_CD, 1, 3) = '076') Then
   Case (MATERIAL_CAT2_CD) Of
             Begin
   '010': >>>0.001
             '040': 0.067
   '020': 0.032
   Default: 0.093
   End
Else If (TIME_SID < 20040126 AND SUBSTR(COMPANY_CD, 1, 3) = '076') Then
0.0465
Else
0
End If


I would greatly appreciate if anyone can shed some light for me regarding this issue. Thank you very much.

elkoreano85
Title: Re: Case Statements
Post by: elkoreano85 on 09 Apr 2008 08:42:54 AM
I found out what the problem is, its a simple return statement.