DateToString function problem

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
jaysheel
Participant
Posts: 57
Joined: Mon Apr 07, 2008 1:54 am
Location: Bangalore

DateToString function problem

Post by jaysheel »

Hi,

I am trying to convet an incoming Date('mm/dd/yy') in Varchar format to Date ('yyyy-mm-dd').
I have used the following function in transformer.

If IsNull(LNK_XFRM_REAL_EST_STORES_DM.store_open_dt) Then SetNull() Else StringToDate(LNK_XFRM_REAL_EST_STORES_DM.store_open_dt,"%mm/%dd/%yy") .

And I am getting the error :

main_program: Fatal Error: Added field has duplicate identifier():

Any idea what might be the problem. :shock:
- Jaysheel -
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If you make the derivation just "SetNull()" then I am fairly certain the error will still be there. I think it has to do with your column name.
jaysheel
Participant
Posts: 57
Joined: Mon Apr 07, 2008 1:54 am
Location: Bangalore

Post by jaysheel »

This string to date never worked for me correctly.
Even without that null handling it didnt work for me.
Same error. :(
- Jaysheel -
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The point that I was trying to make is that your error has nothing to do with the DateToString() function.
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

The problem must NOT be because of the null handling logic, String to Date function in the Transformer Stage.

Please privide us any more error messages if you are able to find them.
sureshabbisetti
Participant
Posts: 21
Joined: Thu Oct 04, 2007 4:34 am
Location: India
Contact:

Post by sureshabbisetti »

Hi,

Instead of SetNull() function try with default value like'0001-01-01'.
Please correct me if I am wrong?

Regards
Suresh
Thanks & Regards
Suresh Kumar Abbisetti
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

The problem is NOT because of SetNull() being used there. There is no need to substitute this implementation with default value.

We can not take any immediate conclusion of what problem is until author(jaysheel ) comes up with more error messages.
Sravani
Participant
Posts: 23
Joined: Thu Jun 15, 2006 3:56 am
Location: Hyderabad

Post by Sravani »

Hi,

I think the problem is not with SetNull() but is with IsNull() function. Sometimes it does not recognize the null value in the input string. Instead SETNULL() try with the following
Len(Trim(LNK_XFRM_REAL_EST_STORES_DM.store_open_dt))=0

Hope it will work for you.

Thanks.
Sravani
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

No Sravani,

The problem is NOT because of IsNull() funtion, either. And teh suggestion you provided is not correct and not needed at first.
Post Reply