Hi Prabhu
What exactly you want to do and what does the 3rd condition do?
Sam
Need SubString
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 209
- Joined: Fri Jan 09, 2004 1:14 pm
- Location: Toronto, Canada
- Contact:
Re: Need SubString
praburaj,
You need an output column in your transform stage that has a derivation something along these lines:
I wasn't completely clear on what you want in your second condition, but it should be something similar to what you see above.
If the Parent_expense_level is coming from your hash file as a lookup value, ensure you are setting either a constraint or a default value if the lookup fails.
Hope this helps,
Rob
You need an output column in your transform stage that has a derivation something along these lines:
Code: Select all
If input.expense_level [1,3] <> 'LPG' then input.expense_level else
if input.expense_level [1,3] = 'LPG' then 'NPG' : input.parent_expense_level [4,30] else
if input.expense_level [1,3] = 'LPG' and index(input.expense_level, '*', 1) = 0 then >reject processing of your choice<
If the Parent_expense_level is coming from your hash file as a lookup value, ensure you are setting either a constraint or a default value if the lookup fails.
Hope this helps,
Rob
Rob Wierdsma
Toronto, Canada
bartonbishop.com
Toronto, Canada
bartonbishop.com
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA
Hi Prabhu
I think you can join condition 2 and 3 and use Robs code like this:
IHTH
Sam
I think you can join condition 2 and 3 and use Robs code like this:
Code: Select all
If input.expense_level [1,3] <> 'LPG' then input.expense_level else
if input.expense_level [1,3] = 'LPG' and index(input.expense_level, '*', 1) = 1 then 'NPG' : input.parent_expense_level [4,30] else
<reject or error>
Sam
Because your everyone's favouriteray.wurlod wrote:Why me particularly?
![Wink :wink:](./images/smilies/icon_wink.gif)
Actually you need to put the codes advised by our fellow forum users in a stage variable and for the last value specify a default value like say 'R'.
In the constraint of your target you need to specify
stgvar <> 'R'
and in the constraint for the reject file specify
stgvar = 'R'.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 232
- Joined: Fri Sep 30, 2005 4:52 am
- Contact:
Code: Select all
If input.expense_level [1,3] <> 'LPG' then input.expense_level else
if input.expense_level [1,3] = 'LPG' and index(input.expense_level, '*', 1) = 1 then 'NPG' : input.parent_expense_level ['*',1,1] else
<reject or error>
Thanks,
Anupam