New file tries to overwrite file created in this run

Hi,

We have a workflow that takes a large text file of invoice data and processes it against a datamapper, turning it into a series of identifiable invoice documents which are then formatted against a template. The workflow is currently set up to then send this output directly to a printer, but I’m trying to change the process to instead print them directly to PDF instead.

I’m fairly sure I’ve configured the Output Creation Settings correctly (sending to Generic PDF, outputting to directory), and have set dynamic elements in the file name field to ensure that a distinct, unique filename is generated each time.

If I test this with a simple input file (containing just one invoice) it works fine, and produces a PDF with the right name exactly where I expect it to. If I try a more complex file containing multiple invoices (which the datamapper correctly identifies and recognises as being multiple output documents), I get the following error in Workflow:

W3001 : Error while executing plugin: HTTP/1.1 500 Internal Server Error LoggedApplicationException: There was an error running the output creation process caused by ApplicationException: New file tries to overwrite file created in this run ‘C:\Users\ppres.service\Connect\filestore\Outputs.2770469518276837423\2018\06\13\Monthly-Statement-H04-M47-S44.pdf’ (SRV000042)
Create Output: W1603 : Plugin failed - 16:47:44 (elapsed time: 00:00:01:024)

The path it mentions isn’t the output path I had set, so I can only assume this is some sort of temp path whilst the PDFs are being generated.

What am I missing? Should this work, or is there more to it than I am assuming?

Many thanks,

Rich

You’re right, that’s the temp path before getting moved to the final location. And the problem is just what you might suspect: You’re generating non-unique names with your output preset. It looks like you’re setting Hour, Minute, Second of the run, but it’s very possible for two files to be generated in the same second. So you might consider adding milliseconds into the mix, or adding another unique value onto the name.

The path you see is the path were the PDF files are before they are given back to Workflow. Now the error also states that there is already a file with the same name. Since your naming is using hour, minutes, seconds, my guess is that there was files with the same time stamp created. Connect can often created multiple PDF in a single second.

You’re an absolute star! Been trying to work that one out for ages! Now sorted, by adding more parameters to make the filename totally unique.

As an aside, should it be possible to pull through meta data for use in filename creation too? For example, each document has a distinct ‘Account_No’ value that is identified in the datamapper and passed to the output template. I’ve tried calling that via ${document.account_no} but no joy, so I suspect there is another step involved somewhere.

Happy to post this as a separate / new question if that’s better?

All the best,

Rich

You’re right, there is another step involved. You need to first define the metadata fields in the Job Preset. Also the syntax is different from what you’re thinking.

From the documentation:

http://help.objectiflune.com/en/planetpress-connect-user-guide/2018.1/#designer/Output/Print/Variables_available_in_the_Output.htm

Syntax:

${document.metadata.propertyname} or ${document.metadata[‘propertyname’]}

Notes:

Value of a meta data property of the document.

The propertyname must have been defined as a Tag Name on the Document Tags tab of the Metadata options page in the Advanced Print Wizard or Job Creation preset.

Note: this variable is only available if Separation based on Document has been selected on the Separation optionspage in the Advanced Print Wizard or Output Creation preset.

Thanks AlbertsN, that’s exactly what I was after, now working a treat and correctly stamping each output filename with the account number. Much appreciated!

All the best,

Rich