Abort transform if all rows are empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 04:55 PM
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.
Number | Short Desc | Desc |
111 | test1 | |
222 | test2 | |
333 | test3 |
Appreciate all the help. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2023 12:24 AM
you can query entire import set table and check if all rows are empty but it would be a lengthy logic.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 10:52 PM
Hi Evren,
onbefore Transform script also work, Just try it out first
if (source.short_description.nil()){
ignore = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 11:09 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 01:12 AM
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;
}