Transform map Script use case

Hiteish222
Kilo Guru

I want to import an excel with fields like sr_no, name, phone and with 100 records.

scenario is that , I want to only insert records after 50th records and also if in any record phone field value is empty 
then that record should not be inserted.

how can we achieve it ? 

1 ACCEPTED SOLUTION

NishantDhole
Mega Guru

Hi,

We can use onBefore Transform Script to achieve this scenario. Please find below code:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var num = parseInt(source.u_sr_no);
if(num <= 50 && !source.u_phone){
ignore = true;
return;
}
})(source, map, log, target);

View solution in original post

2 REPLIES 2

webdark382
Tera Contributor

Hi,

We can use onBefore Transform Script to solve this scenario. Please find the below code:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var num = parseInt(source.u_sr_no);
if(num <= 50 && !source.u_phone){
ignore = true;
return;
}
})(source, map, log, target);

NishantDhole
Mega Guru

Hi,

We can use onBefore Transform Script to achieve this scenario. Please find below code:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var num = parseInt(source.u_sr_no);
if(num <= 50 && !source.u_phone){
ignore = true;
return;
}
})(source, map, log, target);