View Single Post
  #5  
Old March 15th, 2019, 04:05 PM
ThomasLewis's Avatar
ThomasLewis ThomasLewis is offline
Senior Contributor
 
Join Date: Feb 2011
Posts: 211
Default Re: Original Input File Name Path

Sorry if I confused the issue with the product names. The server itself has the API on it. In this particular case, it's just used to compose jobs being sent to Producer.

I understand everything you are saying and understand the limits and intent of the product.

I will try to elaborate on the workflow. The client sends a data list to an account manager who then creates a job number. A folder is created on a file server which is named the job number. The data file which is named by the customer is then placed in that folder.

So it might look something like this: //SERVER/Jobs/12345/filename.csv

The data team then gets the job. They simply open the PDF FusionPro template and define the data file. Then the job is composed using the FusionPro Producer server. The job is then sent off to the other server which has no knowledge of the file server where the original csv came from.

Inside the template is an OnNewOutputFile rule.

Code:
var template_name = "MyTemplateName.pdf";
FusionPro.Composition.outputFileName = get_job_no(template_name) + "_MyOutputName.pdf";
When this file is then sent off to the server for composition, FusionPro.inputFileName of course gets a new path local to the server, no longer the original path to the csv. This makes perfect sense. I'm not questioning that at all.

What I need is to get the folder name (the job number) from the original path of the csv so the output file can be renamed with the job number. This is the only place where the job number would reside as its not part of the csv or of any other rules being brought in as data.

The original input file path is preserved in the def file in the server working folder:

Code:
<?xml version="1.0" encoding="UTF-16"?>
<!--Data Source Definition file generated by: FusionPro(R) VDP Server 10.1.9
 (http://www.pti.com)-->
<DataDefDict 
MajorVersion = "7" 
MinorVersion = "1">
<Assembler> 
   <DataSource 
      FileName = "..\..\Jobs\12345\filename.csv"
      Type = "Delimited Text" 
      Delimiter = "," 
      FirstRow = "true" 
      TaggedStrings = "false" 
      Encoding = "default" 
   />
The function posted earlier reads the def in as an external data file and extracts that job number so when OnNewOutputFile runs, it can properly rename the output file with the job number.

With the output file named with the job number prefix, it can then go into a queue to be proofed and so forth.

What would be ideal is to avoid having to read in the def since FusionPro already knows that path. If there was a function to grab the original data file input path, instead of the current path the server needs at composition, this would be pretty straight forward.

I really hope this clears things up. As it stands, the problem is solved, it just feels clunky.
Reply With Quote