Filter Stage

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
opdas
Participant
Posts: 115
Joined: Wed Feb 01, 2006 7:25 am

Filter Stage

Post by opdas »

Hi
I have a requirement where I need to filter incoming data based on Date i.e there is a column Process_timestamp(data type: Time stamp), I need records where Date(Process_timestamp)=current date - 1 day

What would be the syntax in the where clause in filter stage

Any help is appreciated.

Regards
Om Prakash
ashwin141
Participant
Posts: 95
Joined: Wed Aug 24, 2005 2:26 am
Location: London, UK

Filter Stage

Post by ashwin141 »

Hi Om

What exactly is the problem you are facing? Is it that you are unable to findout how to get the current date in the where clause or something else?

Regards
Ashwin
opdas
Participant
Posts: 115
Joined: Wed Feb 01, 2006 7:25 am

Post by opdas »

Its the syntax ,
Can I use the function used in transformer in where clause of filter stage?
ashwin141
Participant
Posts: 95
Joined: Wed Aug 24, 2005 2:26 am
Location: London, UK

Filter Stage

Post by ashwin141 »

I am not sure :(
May be you can try using CurrentDate(). If it works let us know.

Ashwin
opdas
Participant
Posts: 115
Joined: Wed Feb 01, 2006 7:25 am

Post by opdas »

Hi,
I have used the below code in the "Where Clause"

Code: Select all

TimestampToDate(Process_timestamp)=DateFromJulianDay(JulianDayFromDate(CurrentDate())-1)
When run geting the below Fatel error:

Code: Select all

Filter_36: Parse error: Expected comparison, 'between', or 'like' operator, got: "("
Parse error: Expected boolean operator (and, or) got: "Process_timestamp".
ccatania
Premium Member
Premium Member
Posts: 68
Joined: Thu Sep 08, 2005 5:42 am
Location: Raleigh
Contact:

Post by ccatania »

You can calculate the date in a Tranform Stage Varaible, place the value in an ouput field. Use that field in your filter.
Charlie
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You can add it as a constraint in the transformer. This will filter all your records.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
opdas
Participant
Posts: 115
Joined: Wed Feb 01, 2006 7:25 am

Post by opdas »

Yes, Thats what I'm doing now generating two new columns in the transformer stage for current date - 1 day and converting timestamp to date in another and comparing it in filterstage.
OR
I can filter it inside the transformer it self and I dont need a filter stage.

But what I thought was Filter stage should be exhaustive enough to handle complex filters , otherwise the very purpose of having a filter stage fails !
Post Reply