Page 1 of 1
How to implement "Not In" function in Filter Stage
Posted: Thu Sep 04, 2008 3:54 am
by tjhaosse
I have a SQL like
"a not in ('1','2','3')"
because some reason, i "MUST" use datastage job only to do this SQL statement.
can anyone know how to use filter stage(maybe transformer stage...) to implement "Not in" in PX job?
Posted: Thu Sep 04, 2008 4:36 am
by AmeyJoshi14
Hi,
In the filter stage you can use
'<>' along with
'and' operator.
For example:
Suppose in my fisrt link i want only those employee who Employee number are not in 2 and 6..then this logic can implemented i filter as :
Code: Select all
EMP_NO <> 2 AND EMP_NO <> 6
Output link=(link where you want to pass this records)
Hope this will help you out!
![Wink :wink:](./images/smilies/icon_wink.gif)
Posted: Thu Sep 04, 2008 6:23 am
by tjhaosse
Thanks AmeyJoshi
But If my sql statement had many many case like:
Not in ('1','a',....etc...to much @_@)
can you teach me how should i do ?
AmeyJoshi14 wrote:Hi,
In the filter stage you can use
'<>' along with
'and' operator.
For example:
Suppose in my fisrt link i want only those employee who Employee number are not in 2 and 6..then this logic can implemented i filter as :
Code: Select all
EMP_NO <> 2 AND EMP_NO <> 6
Output link=(link where you want to pass this records)
Hope this will help you out!
![Wink :wink:](./images/smilies/icon_wink.gif)
Posted: Thu Sep 04, 2008 6:30 am
by gabrielac
One possibility would be to create a source file with all the possible values, then use a lookup stage, and filter stage to filter those that were not found.
HTH, Gaby
Posted: Thu Sep 04, 2008 6:49 am
by AmeyJoshi14
gabrielac wrote:One possibility would be to create a source file with all the possible values, then use a lookup stage, and filter stage to filter those that were not found.
HTH, Gaby
Oops my bad!
But the post by gabrielac is really amazing.. :D
I am gona ask this question in the interviews.. and that's the answer
Just kidding!:lol:
![Laughing :lol:](./images/smilies/icon_lol.gif)