Can I ignore blank rows in an import?

KB15
Giga Guru

I have a CSV that has blank rows at the end. The import fails because it expected x number of columns. DBAs seem they can't control this on their export. I have my doubts.

Can do anything on the ServiceNow end to ignore blank rows during the import process? Would I also have to do the same for the transform to ignore blank records?

Just for clarification, this is during the load and not the transform. The export from the SQL query has blank rows and when ServiceNow loads it into a table, it will error at the end because it expects more than one column. You wouldn't be able to run any transform rules to work around it.

1 ACCEPTED SOLUTION

Hitoshi Ozawa
Giga Sage
Giga Sage

Create property "com.glide.csv.loader.ignore_non_parseable_lines" = true. This should ignore the error and load the data. The data can be validated after the load during the transform.

This property is not created in OOTB ServiceNow and needs to be created.

https://docs.servicenow.com/bundle/paris-platform-administration/page/administer/import-sets/referen...

View solution in original post

7 REPLIES 7

This is done through some SQL query that I have zero knowledge of.

Gaurav Shirsat
Mega Sage

Hello KB

You have to do this using Transform Map Script

Use the onBefore transform script, use the script provided by sachin Namjoshi or

you can with this script.

use the GlideRecord call into your data source table, look for the specific record/field, and set ignore=true if it is blank.

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

var gr = new GlideRecord('u_data_source');

gr.addQuery('sys_import_set', import_set.sys_id);
gr.addNullQuery('field_x');
gr.query();
if(gr.next()) {
   ignore = true;
}

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

Please Mark Correct and Helpful

Thanks and Regards

Gaurav Shirsat

 

Hitoshi Ozawa
Giga Sage
Giga Sage

Create property "com.glide.csv.loader.ignore_non_parseable_lines" = true. This should ignore the error and load the data. The data can be validated after the load during the transform.

This property is not created in OOTB ServiceNow and needs to be created.

https://docs.servicenow.com/bundle/paris-platform-administration/page/administer/import-sets/referen...