• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

I would like to ignore missing data error on bulk import

New Here ,
Feb 20, 2021 Feb 20, 2021

Copy link to clipboard

Copied

Hi I keep getting a missing data error when I am importing data. It is likely I will always be missing some data due to the nature of the source data so I just want to ignore that error and continue my script to the next row. I am using a version of this script but it stops due to err==3 occuring:

 

// specify the filename of the data file
var fileName = "/Users/username/tmp/data.txt"; // the tab delimited text file containing the data
var outputDir = "/Users/username/tmp/"; // make sure this ends with a '/'

var err = 0;
var idx = 0;
while (err == 0) {
err = this.importTextData(fileName, idx); // imports the next record
if (err == -1)
app.alert("Error: Cannot Open File");
else if (err == -2)
app.alert("Error: Cannot Load Data");
// else if (err == -3)
// We are not reporting this error because it does
// indicate the end of our data table: We've exhausted
// all rows in the data file and therefore are done with
// processing the file. Time to exit this loop.
// app.alert("Error: Invalid Row");
else if (err == 1)
app.alert("Warning: User Cancelled File Select");
else if (err == 2)
app.alert("Warning: User Cancelled Row Select");
else if (err == 3)
app.alert("Warning: Missing Data");
else if (err == 0) {
this.saveAs(outputDir + this.getField("Text1").value + "_" + this.getField("Text2").value + ".pdf"); // saves the file
idx++;
}
}

TOPICS
PDF forms

Views

405

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 20, 2021 Feb 20, 2021

Remove the app.alert for this case.

Votes

Translate

Translate
Community Expert ,
Feb 20, 2021 Feb 20, 2021

Copy link to clipboard

Copied

LATEST

Remove the app.alert for this case.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines