Select the record with 0x0 inside the field by using Filter
Moderators: chulett, rschirm, roy
Select the record with 0x0 inside the field by using Filter
I have a simple testing job as below
Row Generator --> Transformer --> Filter --> Peek
APT_STRING_PADCHAR = 0x0
Row Generator
A: String[1]
B: String[10]
Transformer
C: String[10] = A
D: String[10] = B
Filter
Peek1 <-- C like '%0x0%'
Peek2 <-- D like '%0x0%'
From above design, field C should contain '0x0' inside, however, the filter can not select them out.
Anyone know how to select the record with '0x0' inside the field by using Filter ?
Row Generator --> Transformer --> Filter --> Peek
APT_STRING_PADCHAR = 0x0
Row Generator
A: String[1]
B: String[10]
Transformer
C: String[10] = A
D: String[10] = B
Filter
Peek1 <-- C like '%0x0%'
Peek2 <-- D like '%0x0%'
From above design, field C should contain '0x0' inside, however, the filter can not select them out.
Anyone know how to select the record with '0x0' inside the field by using Filter ?
-
- Premium Member
- Posts: 301
- Joined: Thu Jul 14, 2005 10:27 am
- Location: Melbourne, Australia
- Contact:
Despite the help file documenting that you can use LIKE with regular expressions in Filter stages we've never managed to get it to work on 7.1r2
Wouldn't it be easier to do this in the Transformer?
Try using :
HTH,
J.
Wouldn't it be easier to do this in the Transformer?
Try using :
Code: Select all
Index( InStream.InColumn, '0X0',1)
J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
A slight correction jhmckeever, if I may:
in the constraint to filter records that contain the literal '0X0'
Code: Select all
Index( InStream.InColumn, '0X0',1) > 0
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Premium Member
- Posts: 301
- Joined: Thu Jul 14, 2005 10:27 am
- Location: Melbourne, Australia
- Contact:
Oh ... and if you want to use proper regular expressions in your transformer there's the C source code for a Parallel Routine to achieve this <a href="viewtopic.php?t=107882">here</a>.
HTH,
J.
HTH,
J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
-
- Premium Member
- Posts: 301
- Joined: Thu Jul 14, 2005 10:27 am
- Location: Melbourne, Australia
- Contact:
Thanks DSguru2B,
Whilst we're on that point, wouldn't a constraint without the >0 work OK?
I thought Booleans were expressed as zero for FALSE and non-zero for TRUE? So a positive Index match would be interpreted as TRUE and a Index non-match would equate to FALSE. Is that wrong?
(I'm hoping this doesn't qualify as a thread hijack!)
Thanks,
J.
Whilst we're on that point, wouldn't a constraint without the >0 work OK?
I thought Booleans were expressed as zero for FALSE and non-zero for TRUE? So a positive Index match would be interpreted as TRUE and a Index non-match would equate to FALSE. Is that wrong?
(I'm hoping this doesn't qualify as a thread hijack!)
Thanks,
J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
-
- Premium Member
- Posts: 301
- Joined: Thu Jul 14, 2005 10:27 am
- Location: Melbourne, Australia
- Contact:
DSguru2B, ,
We've got a number of jobs which work this way.
I streamed a VarChar column containing Integers 0 to 100 into a transformed and had two output links with constraints:
And got the correct results. So, Boolean expressions can be zero (FALSE) or non-zero (TRUE).
I'm ASSUMING this also works for Server - I've only tested on PX.
John.
We've got a number of jobs which work this way.
I streamed a VarChar column containing Integers 0 to 100 into a transformed and had two output links with constraints:
Code: Select all
Link1 Constraint: Index (InputCol, '1', 1) &
Link2 Constraint: Not( Index (InputCol, '1', 1) )
I'm ASSUMING this also works for Server - I've only tested on PX.
John.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
kumar_s wrote:What is the result that you get out of Filter? No output?
Could you pass the input to a Peek stage and post the data here?
Does it one with any other condition other that '0x0'? ...
The input is using the default generated value, that is
Record 1 : A = a ; B = aaaaaaaaaa
Record 2 : A = b ; B = bbbbbbbbbb
.
.
.
jhmckeever, DSguru2B,
Thanks for your input. I know it is easy to be done in Transformer Constraint, however, what I want is to use "Filter" to achieve the requirement.