How to check the condition?

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
reshma11
Premium Member
Premium Member
Posts: 25
Joined: Mon Oct 13, 2008 7:52 am

How to check the condition?

Post 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?
nani0907
Participant
Posts: 155
Joined: Wed Apr 18, 2007 10:30 am

Post 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
thanks n regards
nani
BugFree
Participant
Posts: 82
Joined: Wed Dec 13, 2006 6:02 am

Post 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.
Ping me if I am wrong...
reshma11
Premium Member
Premium Member
Posts: 25
Joined: Mon Oct 13, 2008 7:52 am

Re: How to check the condition?

Post 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'
Post Reply