hi,
i would like to know if it's possible to replace a value by the value on the line before.
I think it is possible in a transformer but i'm not sure.
i explain .
i have this kind of file :
week value
1 25
2 0
3 56
and i want to replace the 0 by 25.
1 25
2 25
3 56
thanks
read the line before
Moderators: chulett, rschirm, roy
ok, but the problem is a little bit hard.
i have one hash file that contain a date and a value associate to this date.
this value is different from 0.
ex:
date1 | val
-----------------------
01/01/04 | 25
08/01/04 | 26
29/01/04 | 32
the reference link contains all datas (values could be equal to 0).
ex :
date2 |val
-------------------
01/01/04 |25
08/01/04 |26
15/01/04 |0
22/01/04 |0
29/01/04 | 32
and i would like to have :
date2 |val
------------------
01/01/04 | 25
08/01/04 | 26
15/01/04 | 26
22/01/04 | 26
29/01/04 | 32
my problem is to link the date in the transformer.
i must use a stage variable to stock the value of the first example and my stage variable should keep the value until the date2<date1
i have one hash file that contain a date and a value associate to this date.
this value is different from 0.
ex:
date1 | val
-----------------------
01/01/04 | 25
08/01/04 | 26
29/01/04 | 32
the reference link contains all datas (values could be equal to 0).
ex :
date2 |val
-------------------
01/01/04 |25
08/01/04 |26
15/01/04 |0
22/01/04 |0
29/01/04 | 32
and i would like to have :
date2 |val
------------------
01/01/04 | 25
08/01/04 | 26
15/01/04 | 26
22/01/04 | 26
29/01/04 | 32
my problem is to link the date in the transformer.
i must use a stage variable to stock the value of the first example and my stage variable should keep the value until the date2<date1
which means ??Can you not do 2 lookups and performthe IF 0 logic in the transform stage?"
i always must replace the zero value by the last non-zero value ... it seems simple, but stage variable just keep in memory the value of the previous row ...
that's why i put in a hash file all my non-zero values...but it doesn't work, because my date is a key value..
perhaps that i should not use a hash file... [/quote]
Since the date is your key, lookup hash file 1 (will give you either a record not found or a value), and hash file 2 (will give you a value that might be zero) and then the derivation does a
Code: Select all
IF NOT(Hash1Lookup.NOTFOUND) THEN Hash1Lookup.VAL ELSE Hash2Lookup.Val