If you are unable to create a new account, please email support@bspsoftware.com

 

converting a business objects decode statement to a case statement

Started by rrutkowski, 07 Oct 2016 07:50:23 AM

Previous topic - Next topic

rrutkowski

Hi,
I'm new to the community and relatively new to cognos, however, I have experience with sql.  My current task is to convert business objects reports to cognos using the sql statement.  I am having an issue understanding a decode statement.

(decode
(decode(TB_LN_DZV_C2_PMT_SCHED_DIM.PMT_SCHED_TYP_CDE,'I',
decode(TB_LN_DZV_C2_PMT_SCHED_DIM.SCHED_EFF_DTE,TB_LN_DZU_C2_NOTE_RCD_DIM.INT_NXT_SCHED_DTE,'Y','N'),'T',

decode(TB_LN_DZV_C2_PMT_SCHED_DIM.SCHED_EFF_DTE,TB_LN_DZU_C2_NOTE_RCD_DIM.LN_PMT_NXT_SCHED_DTE,'Y','N')),'N',

decode
(decode(TB_LN_DZN_C2_NOTE_SCD_DIM.MAT_DTE, TB_LN_DZU_C2_NOTE_RCD_DIM.NXT_PMT_DUE_DTE,'Y', 'N') || TB_LN_DZV_C2_PMT_SCHED_DIM.MOST_RECNT_PMT_SCHED_IND,'YY','Y','N'),
decode(TB_LN_DZV_C2_PMT_SCHED_DIM.PMT_SCHED_TYP_CDE,'I',
decode(TB_LN_DZV_C2_PMT_SCHED_DIM.SCHED_EFF_DTE,TB_LN_DZU_C2_NOTE_RCD_DIM.INT_NXT_SCHED_DTE,'Y','N'),'T',
decode(TB_LN_DZV_C2_PMT_SCHED_DIM.SCHED_EFF_DTE,TB_LN_DZU_C2_NOTE_RCD_DIM.LN_PMT_NXT_SCHED_DTE,'Y','N')
)
)
)= 'Y'
)
)

this is the case statement I've created but I'm not so confident that it is correct. 
case when ([PMT_SCHED_TYP_CDE] = 'I' and
[SCHED_EFF_DTE] = [INT_NXT_SCHED_DTE])
then('Y')
when ([PMT_SCHED_TYP_CDE] = 'I' and
[SCHED_EFF_DTE] <> [INT_NXT_SCHED_DTE])
then('N')
when ([PMT_SCHED_TYP_CDE] <> 'I' and
[SCHED_EFF_DTE] = [LN_PMT_NXT_SCHED_DTE])
Then ('T')
when ([PMT_SCHED_TYP_CDE] <> 'I' and
[SCHED_EFF_DTE] <> [LN_PMT_NXT_SCHED_DTE])
Then ('T')
when   ([PMT_SCHED_TYP_CDE] = 'I' and
[SCHED_EFF_DTE] = [LN_PMT_NXT_SCHED_DTE])
then('Y')
when   ([PMT_SCHED_TYP_CDE] = 'I' and
[SCHED_EFF_DTE] <> [LN_PMT_NXT_SCHED_DTE])
then ('N')
when   ([PMT_SCHED_TYP_CDE] <> 'I' and
[SCHED_EFF_DTE] = [LN_PMT_NXT_SCHED_DTE])
then ('N')
when   ([PMT_SCHED_TYP_CDE] <> 'I' and
[SCHED_EFF_DTE] <> [LN_PMT_NXT_SCHED_DTE])
then ('N')
when([PMT_SCHED_TYP_CDE] = 'I' and
[MAT_DTE]=[NXT_PMT_DUE_DTE])
then('Y')
when([PMT_SCHED_TYP_CDE] = 'I' and
[MAT_DTE]<>[NXT_PMT_DUE_DTE])
Then('N')

when([MOST_RECNT_PMT_SCHED_IND] ='YY')
then ('Y')
when([MOST_RECNT_PMT_SCHED_IND] <>'YY')
Then ('N')
when([PMT_SCHED_TYP_CDE] ='I' and
[SCHED_EFF_DTE] =[INT_NXT_SCHED_DTE])
then('Y')
when([PMT_SCHED_TYP_CDE] ='I' and
[SCHED_EFF_DTE] <>[INT_NXT_SCHED_DTE])
Then ('N')
when([PMT_SCHED_TYP_CDE] ='I' and
[SCHED_EFF_DTE] <>[INT_NXT_SCHED_DTE])
Then ('T')
when([PMT_SCHED_TYP_CDE] <>'I' and
[SCHED_EFF_DTE] <>[INT_NXT_SCHED_DTE])
Then ('T')
when ([PMT_SCHED_TYP_CDE] ='I' and
[SCHED_EFF_DTE] =[LN_PMT_NXT_SCHED_DTE])
then('Y')
when ([PMT_SCHED_TYP_CDE] ='I' and
[SCHED_EFF_DTE] <>[LN_PMT_NXT_SCHED_DTE])
Then('N')
end