Jump to content

Repeat Record and onnewoutputfile


Hadrian

Recommended Posts

I have a database that has specific quantities to output per store that I want placed in one PDF per store.

Store Sticker Qty

NY 3000

CA 2500

NV 3000

TX 4000

OR 2900

FLA 1500

 

 

I know i have to use repeat record count

FusionPro.Composition.repeatRecordCount = Field("Sticker Qty");

and OnNewOutputfile

FusionPro.Composition.outputFileName = Field("Store") + ".pdf";

How do i get FP to output say all of the 3000 for the NY store to one pdf file and the 2500 for the CA store to another. I know that i can compose to multiple files but that asks for specific quantities per record. I am assuming i need to have FP know the start and stop per record and move to the next record. My question is what callback do i use when using repeatrecord?

Link to comment
Share on other sites

This kind of scenario is exactly why we added support for dynamic, or arbitrary, chunking (and stacking, if you're using imposition) in FusionPro 8.

 

All you need to do is make sure that the "Output to multiple files" box on the Output tab of the composition settings dialog is UNchecked, then add this to the OnRecordStart rule:

if (FusionPro.Composition.repeatRecordNumber == 1)
   FusionPro.Composition.OpenNewOutputFile();

Also, you can specify the file name in the call to OpenNewOutputFile, like so:

if (FusionPro.Composition.repeatRecordNumber == 1)
   FusionPro.Composition.OpenNewOutputFile(Field("Store") + "." + FusionPro.Composition.outputFormatExtension);

Then you can eliminate the OnNewOutputFile rule as well.

Link to comment
Share on other sites

I think i forgot to mention that i intended to use this in order to create a sequenced set of tickets

 

example

NY 3000 number padded pieces in one file "0001", "0002", etc.

 

I am only getting one record or padded record per file

 

i was using this to number the pieces

 

return FormatNumber("0000", 1 + FusionPro.Composition.repeatRecordNumber - 1);

Link to comment
Share on other sites

I think i forgot to mention that i intended to use this in order to create a sequenced set of tickets

 

example

NY 3000 number padded pieces in one file "0001", "0002", etc.

 

I am only getting one record or padded record per file

 

i was using this to number the pieces

 

return FormatNumber("0000", 1 + FusionPro.Composition.repeatRecordNumber - 1);

Okay, that should still work fine in conjunction with the arbitrary chunking logic I posted.

Link to comment
Share on other sites

thought so too but i am only getting the first record or padded number ("0001") per file. i am using a full version of FP8 and made sure the records were no duplicates.

Then you must be doing something differently from the rule logic that's been quoted in this thread. It's working fine for me. Take a look at the attached job.

sample-repeat.zip

Link to comment
Share on other sites

thanks Dan. Did not have the repeatRecordcount in the OnRecordStart. I was wondering where that came into play. I now understand the logic of combining both objects.

Right, you still need to tell it how many times to repeat. That's why I said to add that other code to what you already had in OnRecordStart.

Link to comment
Share on other sites

I'm using the info in this post and it works great except when I use an impo.

Is something specific I need to do to get multiple PDF files when using an impo?

It depends on how the imposition is set up. If you're using stacked imposition, then you also need to add this to OnJobStart:

FusionPro.Composition.chunksBreakStacks = true;

Otherwise, the chunk breaks are deferred until the next stack break by default.

I can't attached the project I'm working on so I'll email it to you.

I can't look at specific jobs offline (outside the context of this forum) unless they go through proper Support channels.

Edited by Dan Korn
Link to comment
Share on other sites

  • 1 month later...

A little different spin on it.

I have a file that has about 26000 records in it that go onto three different letters. The data has a field that identifies which letter that it is supposed to apply to. There are about 79 different record types, which are identified by that field. Is there a way in FP to export the files by that field? Our fulfillment department needs them seperated by that field. We have sorted them into order in our mailing software. It just seems very redundent to have to export 79 files out of the mailing software, and then link to 79 different files, and compile them all seperately.

 

any ideas?

Link to comment
Share on other sites

A little different spin on it.

I have a file that has about 26000 records in it that go onto three different letters. The data has a field that identifies which letter that it is supposed to apply to. There are about 79 different record types, which are identified by that field. Is there a way in FP to export the files by that field? Our fulfillment department needs them seperated by that field. We have sorted them into order in our mailing software. It just seems very redundent to have to export 79 files out of the mailing software, and then link to 79 different files, and compile them all seperately.

 

any ideas?

Sure, just do this in OnRecordStart:

if (FieldChanged("YourFieldName"))
   FusionPro.Composition.OpenNewOutputFile();

Link to comment
Share on other sites

  • 1 month later...
It depends on how the imposition is set up. If you're using stacked imposition, then you also need to add this to OnJobStart:

FusionPro.Composition.chunksBreakStacks = true;

 

Using this method with the sample job with FP 8.1.2, I am having trouble getting the first record to output with the name applied in the rule. Instead it always reverts to whatever name is specified in the Composition window. Records 2 and up work great. Is there any way to get the first record to follow the naming convention from the rule?

Link to comment
Share on other sites

Using this method with the sample job with FP 8.1.2, I am having trouble getting the first record to output with the name applied in the rule. Instead it always reverts to whatever name is specified in the Composition window. Records 2 and up work great. Is there any way to get the first record to follow the naming convention from the rule?

Instead of using the OnNewOutputFile rule, you can set the output file name in the call to FusionPro.Composition.OpenNewOutputFile(), as I explained in the second post in the thread:

http://forums.pti.com/showpost.php?p=10559&postcount=2

Link to comment
Share on other sites

Instead of using the OnNewOutputFile rule, you can set the output file name in the call to FusionPro.Composition.OpenNewOutputFile()

 

That's the way I was setting it up. The only change to the sample-repeat file was the addition of chunksBreakStacks = true and outputting with an imposition. Attached is the revised file with the imposition. Also is a screenshot of the 6 files being output. The one named repeat-Output.pdf is what I was trying to output with the name of the first record, in this case NY.

sample-repeat-imposed.zip

Output-Files.jpg.71d7bdfe3301c74987b7c1c14510531f.jpg

Link to comment
Share on other sites

I'm wondering if anyone got a chance to take a look at this. I'm still trying to get it to work and it would be nice to know if this is a bug or if I'm just missing something. I've really looked it over closely and tried a few different ways of doing it with the same results, the first imposed set does not seem to take the name from the script. Non-imposed works fine though.
Link to comment
Share on other sites

I have the same problem. The only workaround I have come up with is to duplicate the first record in my data. This will will create the first record (the Dup) as the generic name "repeat-output.pdf" and correctly name all records 2 thru ?? It isn't great but it is a work around until we get further info from Dan.
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...