How can I skip updating a field on an import when action == update?

tt-jtw
Kilo Expert

I have a Transform Map that uses change_request as its target table.

 

When the action on an import row is to "insert", I'd like to fill in the Requested by field.

But if the action is "update" (revising an existing Change Request), I'd like to skip updating that field.

 

How do I do this?

 

I was hoping I could evaluate the action variable inside a field map script, but it does not seem to be the case.  

7 REPLIES 7

I'm having the same experience. It's a shame that you can't access the "action" variable within an individual Field Map's Source Script (especially because the Wiki makes it sound like that's exactly what to do).


adiddigi
Tera Guru

if(action == 'insert'){


        target.requested_by = "Fill this with what ever you want to "


}



if(action == 'update'){


        // do nothing.. writing ignore = true will ignore the entire row altogether..


}


Thanks, Abhiram.   I assume you mean to do this in the Run Script.   This is what I ended up with as well.   Was hoping there was a better way to handle in in the field map itself.