【问题标题】:Case when Statements implementation in InformaticaInformatica 中的语句实施案例
【发布时间】:2019-12-27 01:51:24
【问题描述】:

谁能帮助我在 Informatica PowerCenter 中的表达式转换中编写以下 case 语句?

Case      When STATUS_REASON_CODE in ( 'BI Complete' , 'BI Updated', 'BI Complete') and Outcome__c is null and BI_Outcome__c is null then 'PA Required'
              when STATUS_REASON_CODE in ( 'BI Complete' , 'BI Updated', 'BI Complete') and Outcome__c is null 
                                      Then Decode (BI_Outcome__c, 'PA Appeal Pending', 'PA Appeal Required','PA Pending','PA Required',BI_Outcome__c)
                when  STATUS_REASON_CODE in ('PA Appeal Approved', 'PA Approved') and Outcome__c is null  Then 'Approved'
                  when  STATUS_REASON_CODE in('PA Appeal Denied', 'PA Denied') and Outcome__c is null  Then 'Denied'
                  when Outcome__c='PA Pending' then 'PA Required'
                  When Outcome__c='PA Appeal Pending' then 'PA Appeal Required'
                   when  STATUS_REASON_CODE in ('PA Appeal Approved', 'PA Approved') and Outcome__c is null  Then 'Approved'
                  when  STATUS_REASON_CODE in('PA Appeal Denied', 'PA Denied') and Outcome__c is null  Then 'Denied'
         else Outcome__c end

【问题讨论】:

  • 除了最后两个 when 子句与第三个和第四个 when 子句重复之外,您的代码还有什么问题?预期输出是什么?

标签: oracle informatica informatica-cloud


【解决方案1】:

我根本没有看到任何问题。在我看来,这似乎是嵌套的 if-else 语句。您可以使用以下指南来实现自己 -

 IIF ( IN(STATUS_REASON_CODE,'BI Complete' , 'BI Updated', 'BI Complete' ) AND and Outcome__c is null and BI_Outcome__c is null, 'PA Required',
  IIF (STATUS_REASON_CODE in ( 'BI Complete' , 'BI Updated', 'BI Complete') and Outcome__c is null , 
   IIF(BI_Outcome__c = 'PA Appeal Pending', 'PA Appeal Required', 
    IIF(BI_Outcome__c = 'PA Pending','PA Required',BI_Outcome__c)...

当然这并不完整,您需要完成它。这看起来很复杂,但并非不可能。

【讨论】:

    【解决方案2】:

    嵌套 IIF 是一种选择 - 为了便于阅读,我更喜欢使用 DECODE,例如:

    DECODE(True,
        Condition_1, Value_1,
        Condition_2, Value_2,
        ....
    Default)
    

    所以,在你的情况下,这会像这样开始:

    DECODE(True,
        IN(STATUS_REASON_CODE,'BI Complete' , 'BI Updated', 'BI Complete' ) AND and Outcome__c is null and BI_Outcome__c is null, 'PA Required',
        STATUS_REASON_CODE in ( 'BI Complete' , 'BI Updated', 'BI Complete') and Outcome__c is null, ....
        ...
        )
    

    【讨论】:

      猜你喜欢
      • 2012-04-16
      • 1970-01-01
      • 1970-01-01
      • 2020-12-13
      • 2012-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多