Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
My requirement is to load data from excel to oracle table with below conditions
Table columns are
cust_no,Name,Item,Orders,Location,Flag
cust_001, John, Watch,3, Mumbai, I-------------------->flag should change
1.If record already exists in table then FLAG column should change from "I" to "U"
Expected output:
cust_no,Name,Item,Orders,Location,Flag
cust_001, John, Watch,3, Mumbai, U---------------------->Already existing record on table
cust_002, Mathew, Bag, 3, Bangalore, I
cust_001, John, Watch,3, Mumbai, I-------------------->record from excel should insert like this
My job design looks like below screenshot
The problem is new records from excel inserting with flag "I" but existing record flag is not Insert as the new record it just update the existing record Flag
1.InsertRec--->output-->action on table --->Insert
2.Update -->output-->action on table -->Tried with Insert or update ,update or insert,update but it's not inserting as new record
When I tried with Insert as action on table it is inserting the record which is already in table is as below
cust_no,Name,Item,Orders,Location,Flag
cust_001, John, Watch,3, Mumbai, U
when I work with start_date,end_date using SCD component it's giving me exactly what I'm looking for.
Hope you understand the problem.
As soon as possible please help me to resolve this!
Thanks in advance
Hi @TRF,
Here is my expected attached for your perusal, please have a look at it.
Expected Output:
You want hour after the date?
Try to use TalendDate.formatDate("MM/dd/yyyy hh:mm:ss",TalendDate.getCurrentDate())
Hi @TRF,
NO, I don't want hour you can notice data In which 5 records already exists in a table with the start_date as 5/24/2017 and flag as "I" .(ie.for
cust_001,cust_002,cust_003,cust_004,cust_005)
In Excel Records presents are (cust_006,cust_007,cust_008,cust_009,cust_001)
so here cust_001 already exists in the table with start_date 5/24/2017.
what I expect is those records which are already in the table should update its flag from "I" into "U" and start_date
1.update its flag from "I" into "U" and
2.start_date is same as the date in the table ie(5/24/2017) and end_date becomes the system date.
3.record from Excel should insert as new record
that is (cust_001, john, HandBag, 2, Chennai, I, current date.
Hi everyone,
Can anyone help me to get the solution for my scenario?
Hope you understand the scenario!
Hi Sara
I think there is a design issue, should be:
tFileInputEexcel--main--tMap1(inner join)---update..tMysqlOutput (for upate)
|
lookup
|
tMysqlOutput
|
onsubjobok
|
tFileInputExcel--main--tMap2----tMysqlOuput(insert)
on tMap1: do an inner join to get only the records onlywhich already exists in target db, these records will be updated.
Set the flag column to "U"
Set the end date column as TalendDate.getCurrentDate()
on tMap2: just add two new columns in the output table
flag: set it to "I"
start date: set it to TalendDate.getCurrentDate()
Let me know if it works.
Regards
Shong
Hi,
Thanks your quick response @shong
I have followed your job flow as expected I got an output for flag column coming to date
1.for new rec its start_date as 'sys date' works fine.
2.for the record which flag changed from "I" to "U" start_date becomes "null" end_date as "sysdate"
my requirement is that start_date should change based on the record coming data.
I hope you can understand the logic which is missing here
have a look at below screenshot
I would like to achieve that
Hi @shong
Thanks a million
Finally, I got my expected result.
If you don't mind can you explain me in short what is the concept blind this, it would be helpful for me!
You are great!
Thanks a lot