Welcome Guest! Log in
×

Notice

The forum is in read only mode.
Due to some maintenance operations, stambia.org will be switched to read-only mode during the 13th November. It will be possible to read and download, but impossible to post on the forums or create new accounts. For any question please contact the support team.

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
zineddine007 created the topic: How to replace a string in a file
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.
More
12 Aug 2015 13:25 #2 by Pierre-Olivier Mazen
Pierre-Olivier Mazen replied the 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
More
12 Aug 2015 16:35 #3 by zineddine007
zineddine007 replied the 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'.
More
13 Aug 2015 09:49 #4 by Pierre-Olivier Mazen
Pierre-Olivier Mazen replied the 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
More
26 Aug 2015 15:01 #5 by zineddine007
zineddine007 replied the 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