dfalkowitz Posted September 5, 2017 Share Posted September 5, 2017 Hello, We do many recurring jobs, where the only differences are the PDF File names and the database file names. The Job number is used for both, for example: Job Number = 12345 File Name = 12345 Letter Layout.pdf dbase Data Name = 12345.dbf OR Text File Name = 12345.txt (tab delimitted) dbase is our default data file type but for this purpose, a tab text file might be better Is there any way to create a variable/rule to pull in the first 5 chars/digits of the the File Name? So Left(FILENAME,5) = 12345 Can this variable be used for the data source name? ExternalDataFile Name? Thank you! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 5, 2017 Share Posted September 5, 2017 Is there any way to create a variable/rule to pull in the first 5 chars/digits of the the File Name? Which file name? For the output file, you can do this: return Left(FusionPro.Composition.outputFileName, 5); Can this variable be used for the data source name? Sure:return Left(GetFileName(PrimaryInputFile()), 5); ExternalDataFile Name? Well, presumably your code specifies the name of the XDF file, so I'm not sure why you need to calculate it, but you could do something like this: return Left(GetFileName("your external data file name here"), 5); Quote Link to comment Share on other sites More sharing options...
dfalkowitz Posted September 5, 2017 Author Share Posted September 5, 2017 Hello Dan, I guess I should have only asked this question: How can I get the File Name of the Fusion Pro PDF document? *Not input data file name and not the output composition file name Thank you! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 5, 2017 Share Posted September 5, 2017 How can I get the File Name of the Fusion Pro PDF document? *Not input data file name and not the output composition file name You mean the name of the PDF template document? There isn't really a way to get that. (This is because the composition code in FusionPro, nee DL Formatter, predates the concept of a PDF template document, which was introduced in the Acrobat plug-in design tool. Technically, one is not required in a Server composition. It's just a PDF graphic whose pages happen to be static graphic frames on each page in the job.) Let's take a step back: What are you trying to do? Quote Link to comment Share on other sites More sharing options...
dfalkowitz Posted September 5, 2017 Author Share Posted September 5, 2017 Hello, We use the same Fusion Pro Template for many jobs and the name of the Template is: 12345 Letter Layout.pdf Job Number = 12345 Data Source = 12345.dbf or 12345.txt Output File Name = 12345 Letter Live.pdf I would like to automatically update the data source file and the output file, based on the job number. Hopefully :] So when the next job comes in, we open 12345 Letter Layout.pdf and rename to 12399 Letter Layout. Once the PDF is renamed, the data name and output name should update to: Job Number = 12399 Data Source = 12399.dbf or 12399.txt Output File Name = 12399 Letter Live.pdf ------------------------------------ If this is not possible, I would like to have 1 Master Fusion Pro Template: Master FP Template = Letter Layout.pdf Within this template, there is a job number Global Variable. The Data Source and Output File Name should be linked to this variable. job_variable = 12345 Data Source = 12345.dbf or 12345.txt Output File Name = 12345 Letter Live.pdf So when the next job comes in, we open Letter Layout.pdf and update the Global Variable to new job number (e.g. 12399). Once variable is updated, the data source name and output name should update to: Job Number = 12399 Data Source = 12399.dbf or 12399.txt Output File Name = 12399 Letter Live.pdf Thank you! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 5, 2017 Share Posted September 5, 2017 Okay, I see. I think your second idea of a "master" template would work. In OnJobStart, you could set the input and output file names, like so: FusionPro.Composition.inputFileName = job_variable + ".txt"; // or ".dbf"; FusionPro.Composition.outputFileName = job_variable + " Letter Live." + FusionPro.Composition.outputFormatExtension; That said, what you're really trying to do is automate your workflow. So rather than trying to do that in JavaScript rules with FusionPro VDP Creator (Desktop), a more appropriate solution would utilize FusionPro VDP Server. Then you could either write your own application code to invoke the composition with whatever file names you want for the input and output files, or set up a Hot Folder to automatically compose to a certain output file name, based on the name of the data file dropped into the folder. You would be able to do that automation with any FusionPro template, without having to add JavaScript code to each one. Quote Link to comment Share on other sites More sharing options...
dfalkowitz Posted September 6, 2017 Author Share Posted September 6, 2017 ok thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.