Filter Stage - Custom function

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
myukassign
Premium Member
Premium Member
Posts: 238
Joined: Fri Jul 25, 2008 8:55 am

Filter Stage - Custom function

Post by myukassign »

I have the following flow...

Flat File -----------> Filter -------> remaining stages.

In flat file, I have a field product_id. I want to process only those records where the product_id is not null or blank.

I used the following statment in the where clause of a filter stage...

Trim(product_id)<>''

But job geting aborted compaling
"Expected comparison, 'between', or 'like' operator, got: "("
Parse error: Expected boolean operator (and, or) got: "product_id"."


Please help how can I use filter stage to do my job.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Move the trim to an upstream Transformer or Modify stage.

Of course, if you're going to use a Transformer stage, you can eliminate the Filter stage and use constraint expressions in the Transformer stage instead.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
myukassign
Premium Member
Premium Member
Posts: 238
Joined: Fri Jul 25, 2008 8:55 am

Post by myukassign »

Thanks ray...

I knew that option.... but I thought if I can avoid this costly transformer with a filter stage for this simple operation..... That prompted me to ask this...

I hope we cannot do that in filter right....
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

If you are so particular to use within filter then you can include multiple condition for each length possibility.

For example, if the field productId is of 2 char length, you can write

Code: Select all

If productId = '' Or productId = ' ' Or productId = '  ' 
   False Link
Otherwise
  True Link
You can try to pad the field with spaces from source and use a single full length blank check in filter.
krishnuka123
Participant
Posts: 5
Joined: Sun Jan 15, 2006 11:45 pm
Contact:

Mukesh

Post by krishnuka123 »

Should use transform stage in between flat file and filter stage and use below syntax. :lol:


Product_ID : If IsNull(product_id) then setNull() else trim(product_id)
M.K.Madhav
Post Reply