If R1.NEW_CENTRE is not null
Then
Step 2
R1.NEW_CENTRE
Else
Step 2
If TGT.STATUS_GROUP in
(Select STATUS_GROUP From REF_TABLE2 Where OLD_Centre is not null )
Then
Lookup Table :
REF_TABLE3 as R3
Condition:
R2.NEW_CODE= CODE_TEMP
Output: R2.SUS_CENTRE_TRANS||’-Z’
Else
Output: NULL
The most direct approach would be using three queries, the first does the first condition, based on its output you do the second lookup in the second query etc.
ifthenelse(REF_TABLE1.NEW_CENTRE is not null, REF_TABLE1.NEW_CENTRE, ifthenelse(sql('DS', 'SELECT STATUS_GROUP FROM REF_TABLE2 WHERE OLD_CENTRE is not null ') ='SOMETHING', REF_TABLE3.SUS_CENTRE_TRANS||'-Z', 'NULL'))
The issue is the following seems to be not fitting good in the above.
sql(‘DS’, 'SELECT STATUS_GROUP FROM REF_TABLE2 WHERE OLD_CENTRE is not null ')
with a lookup_ext() function.
But frankly I don’t understand that select statement, I mean what the use is. It will return the same value always, the first row with OLD_CENTRE not null.
The main issue is to implement this piece of lookup in the mapping which does not suit well :-
if STATUS_GROUP value return from that SELECT from REF_TABLE2 is present in STATUS_GROUP of TGT table.
The pseudocode then :-
ifthenelse(REF_TABLE1.NEW_CENTRE is not null, REF_TABLE1.NEW_CENTRE, ifthenelse(STATUS_GROUP FROM REF_TABLE2 WHERE OLD_CENTRE is not null ') IS PPRESENT IN TGT.STATUS_GROUP , REF_TABLE3.SUS_CENTRE_TRANS||'-Z', 'NULL'))
It seems to be a tough nut to crack.
Would SQL transfom be helpful? I can think of splitting in three queries as Werner suggested, but need more inputs.
Will not be helpfull. You are looking for a technical solution while you do not u derstand the functional spec or fail to implement it with the right logic.
You may understand the requirement but if you have not provided sufficient information in your posting then we don’t understand it and are unlikely to arrive at a solution that satisfies the requirement. Keep in mind that we are volunteers here. A combative forum member with an exalted attitude will likely be ignored by those of us that can help.
Can you write a query that satisfies your requirement that can be executed directly against the Oracle database using a tool such as SQL*Plus? If you can construct that then we may be able to tell you how to write it using native Dataflow objects. Then again, if you can write that query then the path of least resistance is to simply paste the query into a SQL transform and be done with it.