Page 1 of 1

How to check the condition?

Posted: Thu Mar 26, 2009 6:31 am
by reshma11
Like this in mapping document :-- Populate with MPS.CHN_T1.CHN_STAT_DTE if T5_CUST_MERCH.MERCH_PRNT_CHN_NBR is not null and the Chains status code is closed (MPS.CHN_T1.MCT_STAT_COD = 'C'). Otherwise set to '99991231'


I have stag variable called svChnStatDate: - If IsNull(In_Amex_Chnt1_Demo.CHN_STAT_DTE) Then '99991231' Else TimestampToString(In_Amex_Chnt1_Demo.CHN_STAT_DTE,"%yyyy-%mm-%dd %hh:%nn:%ss")

I am trying to write a condition for this T5_CUST_MERCH.MERCH_PRNT_CHN_NBR is not null and the Chains status code is closed (MPS.CHN_T1.MCT_STAT_COD = 'C'). Otherwise set to '99991231'

like this

If IsNull(In_Amex_Chnt1_Demo.MERCH_PRNT_CHN_NBR) Then
Str('9999123') Else If (In_Amex_Chnt1_Demo.MCT_STAT_COD = 'C')
Then Str('9999123') Else svChnStatDate[1,4]:svChnStatDate[6,2]:svChnStatDate[9,2]


Please help me on this?

Posted: Thu Mar 26, 2009 7:41 am
by nani0907
hello,

you need to pupulate the value CHN_STAT_DTE if CHN_NBR is not null and STAT_COD = 'C'. then the condition is as below

If isnull((CHN_STAT_DTE ) and (STAT_COD = 'C')) then CHN_STAT_DTE Esle 99991231

Posted: Thu Mar 26, 2009 7:49 am
by BugFree
I assume that the (In_Amex_Chnt1_Demo.CHN_STAT_DTE) field is of timestamp and your target field is of string type.
Try out this:

If (IsNotNull(In_Amex_Chnt1_Demo.MERCH_PRNT_CHN_NBR) And (In_Amex_Chnt1_Demo.MCT_STAT_COD = 'C') And IsNotNull(In_Amex_Chnt1_Demo.CHN_STAT_DTE) ) Then TimestampToString(In_Amex_Chnt1_Demo.CHN_STAT_DTE,"%yyyy-%mm-%dd %hh:%nn:%ss") Else '99991231'.

You need to be careful with your target column length. Here you are passing default vaue '99991231' of lengh 8 Or you are passing the converted timestamp of length 18.

Re: How to check the condition?

Posted: Thu Mar 26, 2009 11:16 am
by reshma11
reshma11 wrote:Like this in mapping document :-- Populate with MPS.CHN_T1.CHN_STAT_DTE if T5_CUST_MERCH.MERCH_PRNT_CHN_NBR is not null and the Chains status code is closed (MPS.CHN_T1.MCT_STAT_COD = 'C'). Otherwise set to '99991231'


I have stag variable called svChnStatDate: - If IsNull(In_Amex_Chnt1_Demo.CHN_STAT_DTE) Then '99991231' Else TimestampToString(In_Amex_Chnt1_Demo.CHN_STAT_DTE,"%yyyy-%mm-%dd %hh:%nn:%ss")

I am trying to write a condition for this T5_CUST_MERCH.MERCH_PRNT_CHN_NBR is not null and the Chains status code is closed (MPS.CHN_T1.MCT_STAT_COD = 'C'). Otherwise set to '99991231'

like this

If IsNull(In_Amex_Chnt1_Demo.MERCH_PRNT_CHN_NBR) Then
Str('9999123') Else If (In_Amex_Chnt1_Demo.MCT_STAT_COD = 'C')
Then Str('9999123') Else svChnStatDate[1,4]:svChnStatDate[6,2]:svChnStatDate[9,2]


Please help me on this?

Thanks for your reply.

Finally what I did is:

If (IsNotNull(In_Amex_Chnt1_Demo.MERCH_PRNT_CHN_NBR) And (In_Amex_Chnt1_Demo.MCT_STAT_COD = 'C') And IsNotNull(In_Amex_Chnt1_Demo.CHN_STAT_DTE) ) Then DateToString(TimestampToDate (In_Amex_Chnt1_Demo.CHN_STAT_DTE), "%yyyy%mm%dd") Else '99991231'