Случай реализации Statements в Informatica

Может ли кто-нибудь помочь мне написать приведенные ниже операторы case при преобразовании выражений в Informatica PowerCenter?

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

person Wolverine1985    schedule 27.12.2019    source источник
comment
За исключением последних двух предложений when, которые дублируют 3-е и 4-е предложение when, в чем еще проблема с вашим кодом? Каков ожидаемый результат?   -  person Popeye    schedule 27.12.2019


Ответы (2)


вообще не вижу проблемы. Это кажется мне вложенным оператором 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)...

Конечно, это не полный и вам нужно завершить его. Это выглядит сложно, но не невозможно.

person Koushik Roy    schedule 27.12.2019

Вложенный 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, ....
    ...
    )
person Maciejg    schedule 31.12.2019