transform map script to set field value

tscoggin
Giga Contributor

We are trying to set a field value to "True" before the data is added to the target table. The imported data does not have a value for the field but the field does exist on the Import Set Table. So the question is how can we set a records value or a field before inserting it into the target table.

My attempt

When "onBefore"

Transform Scripts:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

// Add your code here
If (activity == 'insert' || activity == 'update');
target.import_flag = "true";

})(source, map, log, target);

1 ACCEPTED SOLUTION

When I added a gs.info line I found that the system wanted me to declare field as a variable. When I did that the value was accepted.

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

      var u_import_flag ='';


      target.u_import_flag = true;

})(source, map, log, target);

View solution in original post

5 REPLIES 5

When I added a gs.info line I found that the system wanted me to declare field as a variable. When I did that the value was accepted.

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

      var u_import_flag ='';


      target.u_import_flag = true;

})(source, map, log, target);