Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
The code below is not working correctly.
if(TRAN_CD <> 355 and (DFNR_CD = 0 and SUM_TRAN_AMT <> 100 and SUM_TRAN_AMT <> 50 and SUM_TRAN_AMT <> -100 and SUM_TRAN_AMT <> -50), SUM_TRAN_AMT,
if(TRAN_CD <> 355 and (DFNR_CD <> 5200 and DFNR_CD <> 52000 and DFNR_CD <> 25000 and DFNR_CD <> 50191), SUM_TRAN_AMT, 0)) as Charges
When the second if is commented out(see below the first conditional works, when it is uncommented it does not. Any ideas on why?
if(TRAN_CD <> 355 and (DFNR_CD = 0 and SUM_TRAN_AMT <> 100 and SUM_TRAN_AMT <> 50 and SUM_TRAN_AMT <> -100 and SUM_TRAN_AMT <> -50), SUM_TRAN_AMT, 0) as Charges
What do you exactely mean with 'not working correctly'? Can you post some sample lines of input data and what you expect to see?
There are DFNR_CD of 0 that have SUM TRAN AMTS of 100 that are being displayed as a Charge of 100.
They should be displayed as 0
What about the TRAN_CD of these records?
If TRAN_CD <> 355, wouldn't the second if() statement be valuated true?
The tran codes that are 355 should be displayed as 0s as well.
What exactely is wrong with the result?
LOAD
if(TRAN_CD <> 355 and (DFNR_CD = 0 and SUM_TRAN_AMT <> 100 and SUM_TRAN_AMT <> 50 and SUM_TRAN_AMT <> -100 and SUM_TRAN_AMT <> -50), SUM_TRAN_AMT,
if(TRAN_CD <> 355 and (DFNR_CD <> 5200 and DFNR_CD <> 52000 and DFNR_CD <> 25000 and DFNR_CD <> 50191), SUM_TRAN_AMT, 0)) as Charges,
*
INLINE [
TRAN_CD, DFNR_CD, SUM_TRAN_AMT
0, 0,100
355,0,100
];