Prevent output file overwriting in Communications Builder

When an input file generates multiple output PDF files, I need to keep Communications Server from overwriting output PDF document files. I thought I could use FileCopy in a script to create uniquely named files using a counter, but it still seems to be overwriting. Here is the script:

$file_count++;

$err=FileCopy("/data/opentext/projects/ebsnp/rma_fp/output/default_rma_fp.pdf", "/data/opentext/projects/ebsnp/rma_fp/output/" + $file_count + "_rma_fp.pdf");

if(num($err)!=0)

{

  $errtext=ioerrtext($err);

  log(0,"Errortext "+$errtext);

}

I've tried the script after processing in the output connector, after document in the output connector, and after engine, but all of them still overwrite. I'm wondering if my method is incorrect. What is the proper method of doing this? Is there a way to pass a name from Exstream Design Manager to Communications Server to use?

Comments

  • Is "/data/opentext/projects/ebsnp/rma_fp/output/default_rma_fp.pdf" the document generated by Exstream? And the path and the filename are fixed in the connector's "File"-parameter?

    One Communications Server/StreamServe method would be to use "%" for the dynamic part in the Platform/connector, and call setdestpath in the connector's runtime "Document Begin" script. For example:

    Platform/Connector / File: /data/opentext/projects/ebsnp/rma_fp/output/%

    Runtime script:

    $file_count++;

    setdestpath($file_count + "_rma_fp.pdf");

Sign In or Register to comment.