How can I skip updating a field on an import when action == update?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 10:24 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 10:42 AM
Does that field change? It will skip it unless the field changes.
Maybe you could use a source script. Something like:
if(action == insert()){
answer = source.requested_by;
}
else{
ignore = true;
}
Or something like that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 10:46 AM
Or, that is exactly what you meant by evaluating action. Let me think more on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 10:50 AM
What about an onAfter transform script that says
if (action = insert()){
source.requested_by = target.requested_by;
target.update();
}
Or maybe an onBefore and you won't need the update?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 11:17 AM
I cannot use onAfter because that is after the target record is saved. I cannot use onBefore because I do want some fields to update, but not others (on update).
At the moment, I'm pulling those fields out of the field map and setting them in the Transform Map's Run Script. I was hoping there was a simpler way.