Lookup help or Join

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
joefonseca79
Premium Member
Premium Member
Posts: 17
Joined: Mon Feb 18, 2008 7:56 pm
Location: Warwick, RI

Lookup help or Join

Post by joefonseca79 »

I have a source that has a Max Hist Date H only in on link. The other is a Fact table = F.
How do I test if the F.START_DATE > H.MAX_HIST_DATE

I'm sorry it prob is easy but I can't get it.
jOE fOnSEca
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard.
Load the max date into a Lookup File Set with Entire partitioning. This has a constant (say "X") as its key, and the max date as a non-key field.
Use a Lookup stage to lookup the record whose key is "X" from the Lookup File Set. You need a Column Generator stage upstream of the Lookup stage to generate the "X" (a Cycle with only one Value).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
joefonseca79
Premium Member
Premium Member
Posts: 17
Joined: Mon Feb 18, 2008 7:56 pm
Location: Warwick, RI

Premium Content

Post by joefonseca79 »

ray.wurlod wrote:Welcome aboard.
Load the max date into a Lookup File Set with Entire partitioning. This has a constant (say "X") as its key, and the max date as a non-key field.
Use a Lookup stage to lookup the re ...

I just signed up for Premium Content how do i view the response?
jOE fOnSEca
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Re: Premium Content

Post by priyadarshikunal »

joefonseca79 wrote:
ray.wurlod wrote:Welcome aboard.
Load the max date into a Lookup File Set with Entire partitioning. This has a constant (say "X") as its key, and the max date as a non-key field.
Use a Lookup stage to lookup the re ...

I just signed up for Premium Content how do i view the response?
once you get your premium account activated :idea:
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
joefonseca79
Premium Member
Premium Member
Posts: 17
Joined: Mon Feb 18, 2008 7:56 pm
Location: Warwick, RI

Re: Premium Content

Post by joefonseca79 »

priyadarshikunal wrote:
joefonseca79 wrote:
ray.wurlod wrote:Welcome aboard.
Load the max date into a Lookup File Set with Entire partitioning. This has a constant (say "X") as its key, and the max date as a non-key field.
Use a Lookup stage to lookup the re ...

I just signed up for Premium Content how do i view the response?
once you get your premium account activated :idea:
it still doesn't seem to be working. Is there an issue with Lookup stage for v8?
jOE fOnSEca
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Please describe your job design and what output you are getting. Ray's stated solution is quite simple. You're going to generate a single row two column (key 'X' and your max value) lookup dataset that is Entire partitioned (all partitions will be broadcast a complete copy of the lookup set - 1 row). Your output should match the lookup on a your key column literal value and then constrain the output.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What's "not working" about it? People here would need details or your issue in order to provide any level of help.
-craig

"You can never have too many knives" -- Logan Nine Fingers
joefonseca79
Premium Member
Premium Member
Posts: 17
Joined: Mon Feb 18, 2008 7:56 pm
Location: Warwick, RI

Screenshots

Post by joefonseca79 »

chulett wrote:What's "not working" about it? People here would need details or your issue in order to provide any level of help.
Here's some screenshots taht I have I just get a red line in the top section.

How do I post screenshots into the msg board?


1st screenshot
Image

2nd screenshot
Image
jOE fOnSEca
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Re-read Ray's post and make your job design match.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I haven't looked at the images, but a red line (link?) can mean simply that you've failed to join the link to the downstream stage - maybe pulled up 1mm short.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not a link nor a line. Joe, why not post the compiler error? It notes the problem and why your Key Expression is red - it doesn't like the 'Range' function you are using there... where did you get 'Range' from? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In a Lookup stage, in version 8, if you check the Range check box you must also double click and enter a range expression. This means that you are doing a range ("between") lookup. If you want just an ordinary lookup, uncheck the Range check box.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
joefonseca79
Premium Member
Premium Member
Posts: 17
Joined: Mon Feb 18, 2008 7:56 pm
Location: Warwick, RI

...

Post by joefonseca79 »

ray.wurlod wrote:In a Lookup stage, in version 8, if you check the Range check box you must also double click and enter a range expression. This means that you are doing a range ("between") lookup. If you want just an ordinary lookup, uncheck the Range check box.
What I need is to do a Less Than or Equal to the Max(Hist_Date) and compair all the records in the fact table against this Max(Hist_Date)
jOE fOnSEca
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Then uncheck the Range check box, look up the max value, and perform the comparison in an expression in a Transformer stage or Filter stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
joefonseca79
Premium Member
Premium Member
Posts: 17
Joined: Mon Feb 18, 2008 7:56 pm
Location: Warwick, RI

Example

Post by joefonseca79 »

ray.wurlod wrote:Then uncheck the Range check box, look up the max value, and perform the comparison in an expression in a Transformer stage or Filter stage.
I'm sorry i'm still new to Datastage. Can you send me some screenshots of what it would look like?

That would be a giant help.
jOE fOnSEca
Post Reply