Abort transform if all rows are empty

Evren Yamin
Tera Contributor

Hello,

 

I have enabled "copy empty fields" on my transform map. I know this means that all empty values will be copied on the instance.

Thus, is there a way for me to check the value of the columns first and ignore the transform if there is a column where all values are empty on the file being uploaded.

 

Like for example, in this file, all rows for short desc is empty. I want for the transform to be aborted if the file being loaded is like this one. 

NumberShort DescDesc
111 test1
222 test2
333 test3

 

Appreciate all the help. Thank you.

 

13 REPLIES 13

@Evren Yamin 

you can query entire import set table and check if all rows are empty but it would be a lengthy logic.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Komal Gore1
Kilo Expert

Hi Evren,

 

onbefore Transform  script also work, Just try it out first

if (source.short_description.nil()){
ignore = true;
}

Hello @Komal Gore1, I can try this though since I have a lot of fields on the staging table, I will need to add all of the fields on the condition right? 

yes , that's right , initially try with one field and less amount of imported data.

like import file with only 10 records , if this worked , you can add all the fields to your condition.

if (source.short_description.nil() ||   source.field_name_1.nil() || source.field_name_2.nil()){
ignore = true;
}