我正在尝试在DataStage的Transformation Stage中编写以下嵌套的If-Then-else语句,但它给我编译错误。任何人都可以告诉我有没有其他方法可以做到这一点?
If IsNotNull(DSLink16.DECISION_ID)
Then (
If DSLink16.DECISION_RESULT = 1 Then (
If DSLink16.DECISION_CODE = 'ALOW' Then 'DENY'
Else If DSLink16.DECISION_CODE = 'DENY' Then 'ALOW'
Else If DSLink16.DECISION_CODE = 'NOIS' Then 'NOIS'
)
Else If DSLink16.DECISION_RESULT = 2 Then 'DSMS'
Else If DSLink16.DECISION_RESULT = 3 Then (
If APPELANT_CODE = 'CLMT' Then 'ALOW' Else 'DENY'
)
Else If DSLink16.DECISION_RESULT = 4 Then (
If APPELANT_CODE = 'CLMT' Then 'DENY' Else 'ALOW'
)
Else If DSLink16.DECISION_RESULT = 5 Then DSLink16.DECISION_CODE
Else If DSLink16.DECISION_RESULT = 6 or DSLink16.DECISION_RESULT = 7 or DSLink16.DECISION_RESULT = 8 Then 'DENY'
)
Else (
If DSLink16.DECISION_RESULT = 1 Then 'DENY'
Else If DSLink16.DECISION_RESULT = 2 Then 'DENY'
Else If DSLink16.DECISION_RESULT = 3 Then 'ALOW'
Else If DSLink16.DECISION_RESULT = 4 Then 'DENY'
Else If DSLink16.DECISION_RESULT = 5 Then 'ALOW'
Else If DSLink16.DECISION_RESULT = 6 Then 'DENY'
Else If DSLink16.DECISION_RESULT = 7 Then 'DENY'
Else If DSLink16.DECISION_RESULT = 8 Then 'DENY'
)
答案 0 :(得分:0)
看起来每个If都应该有相应的Else块。以下为我工作:
If IsNotNull(DSLink16.DECISION_ID)
Then (
If DSLink16.DECISION_RESULT = 1 Then (
If DSLink16.DECISION_CODE = 'ALOW' Then 'DENY'
ELSE If DSLink16.DECISION_CODE = 'DENY' Then 'ALOW'
ELSE 'NOIS'
) ELSE If DSLink16.DECISION_RESULT = 2 Then 'DSMS' ELSE If DSLink16.DECISION_RESULT = 3 Then (
If DSLink16.APPELANT_CODE = 'CLMT' then 'ALOW' Else 'DENY'
) ELSE If DSLink16.DECISION_RESULT = 4 Then (
If DSLink16.APPELANT_CODE = 'CLMT' Then 'DENY' Else 'ALOW'
) ELSE If DSLink16.DECISION_RESULT = 5 Then DSLink16.DECISION_CODE
ELSE 'DENY'
)
Else (
If DSLink16.DECISION_RESULT = 1 Then 'DENY'
ELSE If DSLink16.DECISION_RESULT = 2 Then 'DENY'
ELSE If DSLink16.DECISION_RESULT = 3 Then 'ALOW'
ELSE If DSLink16.DECISION_RESULT = 4 Then 'DENY'
ELSE If DSLink16.DECISION_RESULT = 5 Then 'ALOW'
ELSE If DSLink16.DECISION_RESULT = 6 Then 'DENY'
ELSE If DSLink16.DECISION_RESULT = 7 Then 'DENY'
ELSE If DSLink16.DECISION_RESULT = 8 Then 'DENY'
ELSE 'DENY' )
答案 1 :(得分:0)
假设DECISION_RESULT
是某种整数,则可以写出最后一块:
If DSLink16.DECISION_RESULT = 3 Or DSLink16.DECISION_RESULT = 5
Then "ALOW" Else "DENY"