- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 11:45 AM
Hi,
I am trying to load data and run a transform map to load them to target table. My requirement is if I try loading the data which I am not expecting then it should just ignore the record and update the remaining records.
Sample Data is as below.
I am trying to run a onBefore Script and checking for the Number which will always start with certain prefix like INC or SINC and ignore SrINC records. Below is the code which I am using when I run the transform map.
var str = source.u_number;
var incregex = /^INC/;
var sniregex = /^SINC/;
if(!incregex.test(str) || !sniregex.test(str)){
ignore = true;
}
Any help on this is very much appriciated.
Thank you in Advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 01:51 PM
Try this
It should work - onBefore transform map script
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var str = source.u_number;
str = str.replace(/[0-9]/g, ''); //replace all numeric part
if((str == 'INC' || str == 'SINC') && (action == 'insert' || action == 'update'))
{
}
else
{
ignore=true;
}
})(source, map, log, target);
Let me know then if you need any further help
Anshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 11:54 AM
var str = source.u_number;
if(str.includes('INC') || str.includes('SINC'))
{
ignore = true;
}
Try this.
It will ignore the prefixes records starting with INC and SINC
If works, please mark answer as correct
Anshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 01:30 PM
Hi Anshu,
I want to Ignore other records other than INC and SINC.
we have a feed coming into our system which have many records that have Many Prefixes and I need to ingore them all and Update only those records with INC and SINC.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 01:45 PM
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var str = source.u_number;
if((str.includes('INC') || str.includes('SINC')) && (action == 'insert' || action == 'update'))
{
}
else
{
ignore=true;
}
})(source, map, log, target);
can you try this onBefore transform map script .
It should work.
Let me know if its not, else mark the answer as correct
Anshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 01:51 PM
Try this
It should work - onBefore transform map script
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var str = source.u_number;
str = str.replace(/[0-9]/g, ''); //replace all numeric part
if((str == 'INC' || str == 'SINC') && (action == 'insert' || action == 'update'))
{
}
else
{
ignore=true;
}
})(source, map, log, target);
Let me know then if you need any further help
Anshu