Jump to content

Output mulitple files with record numbers


sandig199

Recommended Posts

How do I add to the OnNewOutputFile rule to include record numbers in the output?

For example: JobName-Records 1-1000, JobName-Records 1001-2000, JobName-Records 2001-3000, etc

 

I am using FP Imposer to create 4up press sheets and setting each position into stacks of 25.

And setting the composer options in Fusion Pro to output into lifts of 100 records per file.

This is working fine.

My file names are coming over as JobName1, JobName2... no record numbers are included.

 

I put this into my Fusion Pro document OnNewOutputFile but it does not work at all.

 

var recordRange = CurrentRecordNumber()+ 100;//the number of lifts

FusionPro.Composition.outputFileName + "_"+ "test"+recordRange;

 

I could not find an example on the Forum, and I truly have no idea how to do this.

Can you please point me the right direction?

Link to comment
Share on other sites

You have to assign a value to FusionPro.Composition.outputFileName with an =

var iname = GetFileName(PrimaryInputFile()).replace(".csv", "");
var range = CurrentRecordNumber() + "-" + (CurrentRecordNumber() +100);

FusionPro.Composition.outputFileName = iname + "_" + range + "." + FusionPro.Composition.outputFormatExtension;

This assumes the input file is a .csv, otherwise change that part.

Link to comment
Share on other sites

I am not aware of any way to get the template PDF name. I really wish that was a thing as I could make good use of it myself. Unless someone else knows of some way to do it you pretty much have to hardcode it in. 

FusionPro.Composition.outputFileName = "MyTemplateName_" + range + "." + FusionPro.Composition.outputFormatExtension;

 

Link to comment
Share on other sites

5 hours ago, sandig199 said:

Is there a way to use the PDF file name instead of the PrimaryInputFile()?

Sure, you can use the FusionPro.templateFileName property.

I would do the whole thing like this:

var iname = ReplaceFileExtension(GetFileName(FusionPro.templateFileName), "");
var range = FusionPro.Composition.outputRecordNumber + "-" + (FusionPro.Composition.outputRecordNumber + 100);
FusionPro.Composition.outputFileName = iname + range + "." + (FusionPro.Composition.outputFormatExtension || "pdf");
Link to comment
Share on other sites

On 9/1/2023 at 2:22 PM, Dan Korn said:
var iname = ReplaceFileExtension(GetFileName(FusionPro.templateFileName), "");
var range = FusionPro.Composition.outputRecordNumber + "-" + (FusionPro.Composition.outputRecordNumber + 100);
FusionPro.Composition.outputFileName = iname + range + "." + (FusionPro.Composition.outputFormatExtension || "pdf");

Curious. When did "FusionPro.templateFileName" become available? I may have missed it in release notes and the documentation.

Link to comment
Share on other sites

19 hours ago, ThomasLewis said:

Also not listed in the Building Blocks/Objects. Makes you wonder how many other goodies are hidden in there somewhere.

This was a fairly recent addition, in conjunction with another new feature where you can bring in a different DIF file as a repeatable component.

21 hours ago, MartyrSyx said:

Curious. When did "FusionPro.templateFileName" become available? I may have missed it in release notes and the documentation.

Sorry, that was an oversight.  I'm adding it into the Building Blocks now for FP 3.1.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...