on before Robust transform script for ignore some record where (field) Caption doesn't contain " Server".

amar7
Kilo Guru

Hi Community ,

we are using Robust transform map to populate the target table but we have to transform those record's only where the staging table field (Caption) contain "Server".

and we are using OOTB Robust transform map integration , Robust transform map is new to me can someone help me on this , where should i have to script this out to achieve . 

can you please help me with the code also .

 

Thanks in advance !!!

4 REPLIES 4

Mahendra RC
Mega Sage

Hello amar,

You can write onBefore transform script on your transform map with below code to ignore the record with does not contain Server in Caption field:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
    var caption = source.u_caption; // check your Caption field name and replace accordingly
    var lowerCaseCaption = caption.toLowerCase();
    if (lowerCaseCaption.indexOf("server") == -1) {
		ignore = true; // Record will be ignore and not created if the Caption field does not contain Server
	} else {
		//write your code
	}
})(source, map, log, target);

Please mark my respsone as helpful/correct, if it answer your question.

Thanks

Hi Mahendra ,

Thanks for the response 

we are looking for Robust transform map on before script 

the code you provided will work on normal transform map and not in Robust one .

 

VaranAwesomenow
Mega Sage

Robust transform map provides a condition script you can use that. You can decide whether to prevent data from reaching staging itself or from staging to target accordingly in that corresponding RTE entity mapping you can implement the condition.

 

find_real_file.png

I researched this a little further
You can implement this in 3 ways
1. Implement on before script
    gliderecordusing key field from source / target -> if found
        //status = 'SKIPPED';
        or
        //ignore = true;
2. Implement on after script
    On after can access target Object, so you can run a set query to check if its a valid record or not and do a delete.
3. Write a post import script on scheduled import that will do the delete