Transformation Rules/Logic
Moderators: chulett, rschirm, roy
Transformation Rules/Logic
Hi,
I am getting 3 columns named A,B,C from Source and i have to do a lookup to a hashed file which has 2 columns named col_ID,col_code where col_ID has values 20,30,40 and col_code has values A,B,C. I have to match such that if the source column name is 'A' and Hashcolumn Col_code value is 'A' then get the ID and so on.
i.e, I have to match the source name with the hashed column value to get the respective id.
Please drop ur suggestion to handle this.
Thanks in advance
I am getting 3 columns named A,B,C from Source and i have to do a lookup to a hashed file which has 2 columns named col_ID,col_code where col_ID has values 20,30,40 and col_code has values A,B,C. I have to match such that if the source column name is 'A' and Hashcolumn Col_code value is 'A' then get the ID and so on.
i.e, I have to match the source name with the hashed column value to get the respective id.
Please drop ur suggestion to handle this.
Thanks in advance
Sounds like you need multiple reference links to the same hashed file, each one with different literal values in the key expression.
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
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
Your original question stated you needed to align a source column named A to a specific lookup for 3 known values. I now do not understand your followup question because it doesn't correlate to your original.
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
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
sorry for confusion. Let me come again..kcbland wrote:Your original question stated you needed to align a source column named A to a specific lookup for 3 known values. I now do not understand your followup question because it doesn't correlate to your original.
I have a source file with column names A,B,C. And i have a Hashed file with column names Id,col_code, which has values:
ID col_code
20 A
30 B
40 C.
I have to compare the source file column name suppose 'A' with the hashed file column "col_code" value 'A' and get the ID.
Thanks
In the reference link, you need a key expression to match to the primary key. Create three links: link_A, link_B, link_C.
I'm so confused so here's two different answers:
Map column A as the key expression for link_A, B for B, C for C. If the incoming value matches, you'll get your value.
Or
Put literal values in the key expression of "A", "B", and "C" respectively. The exact values will return.
If what you are doing is the second option, you may consider just writing an IF-THEN-ELSE IF statement.
I'm so confused so here's two different answers:
Map column A as the key expression for link_A, B for B, C for C. If the incoming value matches, you'll get your value.
Or
Put literal values in the key expression of "A", "B", and "C" respectively. The exact values will return.
If what you are doing is the second option, you may consider just writing an IF-THEN-ELSE IF statement.
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
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
To make it clear WHY they advised thus, a hashed file can only be looked up using an exact match on its key column(s).
You are trying to do a "reverse lookup", which is not supported by the Hashed File stage (for the reason above).
You could use a UV stage to perform a reverse lookup against your hashed file, but it would be horribly slow. A reverse-defined hashed file is the best solution.
You are trying to do a "reverse lookup", which is not supported by the Hashed File stage (for the reason above).
You could use a UV stage to perform a reverse lookup against your hashed file, but it would be horribly slow. A reverse-defined hashed file is the best solution.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Hey Ray,ray.wurlod wrote:To make it clear WHY they advised thus, a hashed file can only be looked up using an exact match on its key column(s).
You are trying to do a "reverse lookup", which is not supported by the Hashed File stage (for the reason above).
You could use a UV stage to perform a reverse lookup against your hashed file, but it would be horribly slow. A reverse-defined hashed file is the best solution.
I dint understand exactly what u said but what i was trying to do is match the incoming "column name" not the column value with TableA on column "code" which has the name of the incoming column.
Here is the sql/rule i have:
select ID from TableA where source column name = col1_code.
( here col1_code one of the column in tableA)
Thanks
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
col_code is not the key to the hashed file.
Therefore it can NOT be used for lookup via the Hashed File stage.
You need to create a hashed file in which col_code IS the key column.
Therefore it can NOT be used for lookup via the Hashed File stage.
You need to create a hashed file in which col_code IS the key column.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.