code issue... need help

Formally known as "Mercator Inside Integrator 6.7", DataStage TX enables high-volume, complex transactions without the need for additional coding.

Moderators: chulett, rschirm

Post Reply
koji.kazama
Participant
Posts: 2
Joined: Tue Jul 14, 2009 10:25 am
Location: Philippines

code issue... need help

Post by koji.kazama »

hi guys
im working on a program here and here is the rule

=EITHER(
IF(SIZE(LOOKUP(Ref# Element:REF Segment:LoopCLM2300:In1,Ref#Qual'r Element:REF Segment:LoopCLM2300:In1="D9"))>19,TEXTTODATE(RIGHT(LOOKUP(Ref# Element:REF Segment:LoopCLM2300:In1,Ref#Qual'r Element:REF Segment:LoopCLM2300:In1="D9"),6))),

IF(SIZE(LOOKUP(Ref# Element:REF Segment:IN3,Ref#Qual'r Element:REF Segment:IN3="D9"))>19,TEXTTODATE(RIGHT(LOOKUP(Ref# Element:REF Segment:IN3,Ref#Qual'r Element:REF Segment:IN3="D9"),6 ))),

IF(SIZE(LOOKUP(Ref# Element:REF Segment:LoopCLM2300:LoopHL2000C:In1,Ref#Qual'r Element:REF Segment:LoopCLM2300:LoopHL2000C:In1="D9"))>19,TEXTTODATE(RIGHT(LOOKUP(Ref# Element:REF Segment:LoopCLM2300:LoopHL2000C:In1, Ref#Qual'r Element:REF Segment:LoopCLM2300:LoopHL2000C:In1="D9" ),6)), TEXTTODATE(FROMDATETIME(FileDate, "CCYYMMDD")))
)

the thing about this code is that regards if the data satisfies the older rule, this is ignored and the data that satisfies the last condition TEXTTODATE(FROMDATETIME(FileDate, "CCYYMMDD"))) is the one getting mapped. When I removed that code segment, the correct data is not being mapped. Unfortunately, i can not ermoved that code segment since the old rule is a backup in the event that eh new data is not available then the field will have the old data. problem is the old data keeps on getting mapped even if the new one comes along. any thoughts about this issue is greatly appreciated.

thanks
rep
Participant
Posts: 82
Joined: Tue Jun 19, 2007 8:04 am
Location: New York City

...

Post by rep »

It's not going to be easy without seeing the input data and knowing what you're trying to anticipate, but I will say this;


EITHER says "do the first thing that does not equal none".

So if you say

EITHER (LOOKUP(FIELD)),
LOOKUP(FIELD2)))

If field=none, then it will attempt field2. If field2 is none, you'll get none, but if field or field2 returns a value, it will use the first one that returns something.

Your rule says IF(whatever, do this, else,
....................... IF(whatever, do this, else,
then finally, do TEXTTODATE(FROMDATETIME(FileDate, "CCYYMMDD")))

Being you're doing all these "IF's", I don't see the need for the EITHER.

You want to use the EITHER;

EITHER(LOOKUP()),
...........LOOKUP()),
...........LOOKUP()),
TEXTTODATE(FROMDATETIME(FileDate, "CCYYMMDD")))


or use the IF statment;

IF(SIZE(LOOKUP()>19, DATETIME(FIELD1), //ELSE
IF(SIZE(OTHER_LOOKUP)>19, DATETIME(FIELD2) //ELSE
IF(SIZE(ANOTHER_LOOKUP)>19, DATETIME(FIELD3) //ELSE
TEXTTODATE(FROMDATETIME(FileDate, "CCYYMMDD")))

Know what I mean? This may not fix your code, but try to get it using only one of the ways listed and if you still can't get it, post back.
koji.kazama
Participant
Posts: 2
Joined: Tue Jul 14, 2009 10:25 am
Location: Philippines

Re: ...

Post by koji.kazama »

Im still getting the same output wherein the "else" gets mapped bypassing the other results
rep wrote:It's not going to be easy without seeing the input data and knowing what you're trying to anticipate, but I will say this;


EITHER says "do the first thing that does not equal none".

So if you say

EITHER (LOOKUP(FIELD)),
LOOKUP(FIELD2)))

If field=none, then it will attempt field2. If field2 is none, you'll get none, but if field or field2 returns a value, it will use the first one that returns something.

Your rule says IF(whatever, do this, else,
....................... IF(whatever, do this, else,
then finally, do TEXTTODATE(FROMDATETIME(FileDate, "CCYYMMDD")))

Being you're doing all these "IF's", I don't see the need for the EITHER.

You want to use the EITHER;

EITHER(LOOKUP()),
...........LOOKUP()),
...........LOOKUP()),
TEXTTODATE(FROMDATETIME(FileDate, "CCYYMMDD")))


or use the IF statment;

IF(SIZE(LOOKUP()>19, DATETIME(FIELD1), //ELSE
IF(SIZE(OTHER_LOOKUP)>19, DATETIME(FIELD2) //ELSE
IF(SIZE(ANOTHER_LOOKUP)>19, DATETIME(FIELD3) //ELSE
TEXTTODATE(FROMDATETIME(FileDate, "CCYYMMDD")))

Know what I mean? This may not fix your code, but try to get it using only one of the ways listed and if you still can't get it, post back.
rep
Participant
Posts: 82
Joined: Tue Jun 19, 2007 8:04 am
Location: New York City

...

Post by rep »

So you removed the 'EITHER' and are only using the IF statments? Post the code.
Post Reply