Welcome Guest! Log in

Topic-icon Solved How to replace a string in a file

More
12 Aug 2015 10:40 - 12 Aug 2015 11:48 #1 by zineddine007
How to replace a string in a file was created by zineddine007
Hello,
I have a rejection constraint before insertion into the table T lines that come from the file.
It looks if the foreign key exists in the destination table else it rejects this line.
there is a mechanism that makes a exceptionde rejection ??
because I want to insert a line in the even if the the foreign key does not exist in the table

if such mechanism does not exist I thought about this alternative:
The input file contains lines with /t as separation
I want to edit the file to each time I encounter a string 'xxx' by 'yyy'; because xxx is not existe like foreign key the template reject him

Thank you,

Zineddine
Last edit: 12 Aug 2015 11:48 by zineddine007.

Please Log in or Create an account to join the conversation.

More
12 Aug 2015 13:25 #2 by Pierre-Olivier Mazen
Replied by Pierre-Olivier Mazen on topic How to replace a string in a file
Hello,

when you use a REJECT template you have an option deleteRejectsOnCheckedTable. If you set this option to false the FK will be checked and traced into the error table but the corresponding record will be loaded in the target table.

I hope this helps

Please Log in or Create an account to join the conversation.

More
12 Aug 2015 16:35 #3 by zineddine007
Replied by zineddine007 on topic How to replace a string in a file
thank you Pierre-Olivier,
I want to include just the key 'yyy' and not integrate other string that come from the file if it does not exist in the table as FK, it is an exception for that key 'yyy'.

Please Log in or Create an account to join the conversation.

More
13 Aug 2015 09:49 #4 by Pierre-Olivier Mazen
Replied by Pierre-Olivier Mazen on topic How to replace a string in a file
Then, you have another possibility: make an external join to the Parent table and, in the Mapping expression of the column use something like :
CASE
WHEN FK.COL IS NULL THEN NULL
WHEN FK.COL IS NOT NULL AND PK.COL IS NULL THEN 'yyy'
ELSE FK.COL
END

Please Log in or Create an account to join the conversation.

More
26 Aug 2015 15:01 #5 by zineddine007
Replied by zineddine007 on topic How to replace a string in a file

Pierre-Olivier Mazen wrote: Then, you have another possibility: make an external join to the Parent table and, in the Mapping expression of the column use something like :
CASE
WHEN FK.COL IS NULL THEN NULL
WHEN FK.COL IS NOT NULL AND PK.COL IS NULL THEN 'yyy'
ELSE FK.COL
END

Please Log in or Create an account to join the conversation.