Page 1 of 1

Scripting errors (TS2332 and PDF error: ENONT)

Posted: Tue Apr 18, 2023 4:13 pm
by Arsen
1. What is this and where I can find relevant script?
Screenshot 2023-04-18 at 15.54.44.png
Screenshot 2023-04-18 at 15.54.44.png (59.52 KiB) Viewed 8695 times

2. The first time the script works fine, the second time it gives an error.
I took the script from GitHub repository and did not change it.
Screenshot 2023-04-18 at 16.08.17.png
Screenshot 2023-04-18 at 16.08.17.png (81.48 KiB) Viewed 8695 times

Where should I look for the problem and a solution?
Screenshot 2023-04-18 at 15.59.37.png
Screenshot 2023-04-18 at 15.59.37.png (195.21 KiB) Viewed 8695 times

Re: Scripting errors (TS2332 and PDF error: ENONT)

Posted: Fri Apr 21, 2023 12:07 pm
by laurentd
Hi Arsen,

This problem happens because the second time the job is processed, Switch fails to add the dataset with the same name. It does not replace it by default. 2 solutions:
  • use Export metadata and remove the dataset before processing the job a second time
  • edit the script and remove the dataset before adding it:

Code: Select all

        try {
            await job.removeDataset(datasetName);
            // await job.log(LogLevel.Debug, `Removed dataset '${datasetName}'`);
        } catch (error) {
            // dataset does not exist
            // await job.log(LogLevel.Debug, `Dataset '${datasetName}' did not exist`);
        }

Re: Scripting errors (TS2332 and PDF error: ENONT)

Posted: Fri Apr 21, 2023 12:33 pm
by Arsen
Thanks a lot, Laurent. I can handle it from here.