new column
Moderators: chulett, rschirm, roy
new column
Hi,
I am having a job in which I need to create a new column and update this with "y" or "N" based on the result of previous join. Can anybody tell how to do this? what stages to be used etc.
Thanks
Kavuri
I am having a job in which I need to create a new column and update this with "y" or "N" based on the result of previous join. Can anybody tell how to do this? what stages to be used etc.
Thanks
Kavuri
Yes, I created a column by using column generator stage. And I placed a Trasformer stage after column generator.
Here I need to compare fields from two tables one from PROFOTHER_FACT with column name as PROFOTHER_SERVICE_ID and STAY_LINK_FACT with column name as RELATED_SERVICE_ID , If both are equal
and
another field LINK_TYPE_CODE is either "ERPFO" or "HSPFO".
Then, I need to update the value with "Y" or "N".
i tried using If(bhi.PROFOTHER_FACT.PROFOTHER-SERVICE_ID = bhi.STAY_LINK_FACT.RELATED_SERVICE_ID AND LINK_TYPE_CODE = "ERPFO" OR LINK_TYPE_CODE = "HSPFO")
I know that I need to modify the logic in the above, but first of all does the transformer stage will take a table script in it or not?. It is showing in red , if I edit the column.
Anu suggestions appreciated.
Thanks
Kavuri
Here I need to compare fields from two tables one from PROFOTHER_FACT with column name as PROFOTHER_SERVICE_ID and STAY_LINK_FACT with column name as RELATED_SERVICE_ID , If both are equal
and
another field LINK_TYPE_CODE is either "ERPFO" or "HSPFO".
Then, I need to update the value with "Y" or "N".
i tried using If(bhi.PROFOTHER_FACT.PROFOTHER-SERVICE_ID = bhi.STAY_LINK_FACT.RELATED_SERVICE_ID AND LINK_TYPE_CODE = "ERPFO" OR LINK_TYPE_CODE = "HSPFO")
I know that I need to modify the logic in the above, but first of all does the transformer stage will take a table script in it or not?. It is showing in red , if I edit the column.
Anu suggestions appreciated.
Thanks
Kavuri
Use a join stage to join the table first. Then in the transformer check for the condition "LINK_TYPE_CODE is either "ERPFO" or "HSPFO"" and populate the new field. And for the join stage you need to have same field names. So use a copy stage and rename the fields and switch off RCP in the copy stage.
Hi Maveric,
If I understand correctly, i think the one you suggested will not work for me.
because, I need to get all the rows from PROFOTHER_FACT table and I need to update inp_ind field with "Y" if PROFOTHER_FACT.PROFOTHER_SERVICE_ID = STAY_LINK_FACT.RELATED_SERVICE_ID. and the rest.
Thanks
Kavuri
If I understand correctly, i think the one you suggested will not work for me.
because, I need to get all the rows from PROFOTHER_FACT table and I need to update inp_ind field with "Y" if PROFOTHER_FACT.PROFOTHER_SERVICE_ID = STAY_LINK_FACT.RELATED_SERVICE_ID. and the rest.
Thanks
Kavuri
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
I can't think why it will not work for you;kavuri wrote:Hi Maveric,
If I understand correctly, i think the one you suggested will not work for me.
because, I need to get all the rows from PROFOTHER_FACT table and I need to update inp_ind field with "Y" if PROFOTHER_FACT.PROFOTHER_SERVICE_ID = STAY_LINK_FACT.RELATED_SERVICE_ID. and the rest.
Thanks
Kavuri
Can't you use "Left Outer Join" and then check following constraints in transformer:
Code: Select all
STAY_LINK_FACT.RELATED_SERVICE_ID is null and other conditions as you mentioned.
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.
Genius may have its limitations, but stupidity is not thus handicapped.
Hi,
As you said I made a join and the join type as leftouterjoin. So I am getting all the rows from input, and in the transformer stage I had written the following code.
If (DSLink45.LINK_TYPE_CODE = "ERPFO" Or DSLink45.LINK_TYPE_CODE = "HSPFO") Then DSLink45.LINK_TYPE_CODE = "Y" Else DSLink45.LINK_TYPE_CODE = "N"
Now all my rows were dropped and 0 rows were passes to the output file.
That is it is checking for the condition and dropping all rows.
Can you tell me where the exact problem is in my code?
Thanks
Kavuri
As you said I made a join and the join type as leftouterjoin. So I am getting all the rows from input, and in the transformer stage I had written the following code.
If (DSLink45.LINK_TYPE_CODE = "ERPFO" Or DSLink45.LINK_TYPE_CODE = "HSPFO") Then DSLink45.LINK_TYPE_CODE = "Y" Else DSLink45.LINK_TYPE_CODE = "N"
Now all my rows were dropped and 0 rows were passes to the output file.
That is it is checking for the condition and dropping all rows.
Can you tell me where the exact problem is in my code?
Thanks
Kavuri
Must be some other reason for the records being dropped. See if there is any meta data mismatch. what warnings/errors are you getting in the job log? Try comparing the strings with Compare() function.
If Compare(DSLink45.LINK_TYPE_CODE, "ERPFO") Or Compare(DSLink45.LINK_TYPE_CODE, "HSPFO") Then "Y" Else "N"
Derivation would look something like this. Not sure of the syntax though.
If Compare(DSLink45.LINK_TYPE_CODE, "ERPFO") Or Compare(DSLink45.LINK_TYPE_CODE, "HSPFO") Then "Y" Else "N"
Derivation would look something like this. Not sure of the syntax though.
I placed like following
If (Compare(DSLink45.LINK_TYPE_CODE, "ERPFO") Or Compare(DSLink45.LINK_TYPE_CODE, "HSPFO")) Then "Y" Else "N"
Stll all the columns are getting dropped.
I am getting following warning
Transformer_54,7: Field 'LINK_TYPE_CODE' from input dataset '0' is NULL. Record dropped.
Thanks
Kavuri
If (Compare(DSLink45.LINK_TYPE_CODE, "ERPFO") Or Compare(DSLink45.LINK_TYPE_CODE, "HSPFO")) Then "Y" Else "N"
Stll all the columns are getting dropped.
I am getting following warning
Transformer_54,7: Field 'LINK_TYPE_CODE' from input dataset '0' is NULL. Record dropped.
Thanks
Kavuri