i have another questions. i hope someone can help me out...
I want to check in the destination folder if a file exist. If the file is there, then the actual job should be send too.
But i have a problem with the name part. The actual file has the "1_Somename__925171_Di_6-AM-42.pdf" and the second one has the name:
"1_SomeOtherName__925171_Di_6-AM-43.pdf".
I have the job name and the name from the second file. But when it comes to comparsion the regex is not working.
Or i doing something wrong
First i get the name of the job:
Code: Select all
const jobName = await job.getName(true);
Code: Select all
const jobNameSplit = jobName.split('_');
Code: Select all
const pdfComparsionName = await flowElement.getPropertyStringValue("pdfComparsionName");
Code: Select all
const theregex = / [\w-.] /;
Code: Select all
const pdfComparsionNameSearch = jobNameSplit[0] + '_' + pdfComparsionName + '__' + jobNameSplit[2] + '__';
After that i do:
Code: Select all
try {
if (fs.existsSync(pdfComparsionFilePath + pdfComparsionNameSearch + theregex)) {
await job.log(LogLevel.Info, 'The file is here! hooray!');
//await job.sendToSingle();
} else {
await job.log(LogLevel.Info, 'There is no file.');
};
} catch (err) {
await job.log(LogLevel.Warning, 'Something went wrong');
};
So i hope this is not too much.