Jump to content

File output records based on data field


KatJones

Recommended Posts

Here is the details:

I have 1 large data file. Within that data file I have 20 versions. Each version has different quantities.

 

The problem:

I need to output SEPARATE .pdfs based on each version... with each each PDF named what version it is tagged to.

 

Example:

A01 has 33214 records

A02 has 26102 records...etc.

 

I need a PDF named A01.pdf that has 33214 records, and I will need another PDF named A02.pdf with 26102 records and so on....

 

I am certain there is a callback rule that can be created, but my javascript/script writing skills is minimal to none.

Link to comment
Share on other sites

In OnRecordStart:

if (FieldChanged("YourFieldName"))
   FusionPro.Composition.OpenNewOutputFile(Field("YourFieldName") +
       "." + FusionPro.Composition.outputFormatExtension);

 

It says that the FieldChange is not defined once I changed the "yourfieldname".

Link to comment
Share on other sites

Ah! I believe that may be the problem. We are operating on a older version of FusionPro. Is there a code for older versions? We are on 7.2

No, the ability to compose to multiple output files, each of which contains a different number of output records (what we sometimes call "arbitrary chunking") is a new feature in FusionPro 8. It can't be done in 7.2. The only thing you can do with your version is to break up the input file and do multiple compositions.

 

In general, it's best to specify what version you're using when asking a question, as my signature notes.

Edited by Dan Korn
Link to comment
Share on other sites

  • 1 year later...

Hello,

 

Following back up on this. We now have upgraded to 9.1.0. On output do I need to check anything? Like the output to multiple files or anything. Im not seeing my files output as separate files based on the field change.

 

I should mention that I used an imposition file with this. Does that matter?

Link to comment
Share on other sites

Hello,

 

Following back up on this. We now have upgraded to 9.1.0. On output do I need to check anything? Like the output to multiple files or anything. Im not seeing my files output as separate files based on the field change.

The only thing you might need to do is turn off the "Output to multiple files" setting on the Output tab of the Composition Settings, if you had that checked. That sets "static chunking," where each output file (chunk) is the same number of records, but you're trying to use "dynamic chunking," where each output file has an arbitrary number of records. Generally, you want one or the other.

I should mention that I used an imposition file with this. Does that matter?

Yes, the imposition could be the problem. Are you doing stacked imposition? If so, then FusionPro wants to defer the chunk break (start of a new output file) until the next stack break (start of a new imposed stack) by default. You can modify this behavior by setting this in the OnJobStart rule:

FusionPro.Composition.chunksBreakStacks = true;

Although, before doing that, I would first disable imposition just to see if the chunking (multiple output files) is working the way you want without imposition.

Link to comment
Share on other sites

I have tried this with imposition (infinite stack checked and without), without imposition. I didn't have the output to multiple files checked at all. It is still producing one output.

Okay, then maybe the rule is not written correctly. You are using some code similar to what I posted in your OnRecordStart rule, right? If you post the rule syntax here, I might be able to figure out what's wrong with it. Otherwise, I could just keep guessing, but my ESP isn't working well today.

 

You could always try something like this:

if (FieldChanged("<your field name>"))
   Print("The field changed!")

Then look in the composition log (.msg) file to see if that message is printed. If it's not, then you either have the wrong thing there in your "if" condition, or the field value is not actually changing.

 

Here is what the OnRecordStart rule would look like in the Cell Phone tutorial job installed with FusionPro:

if (FieldChanged("Lname"))
   FusionPro.Composition.OpenNewOutputFile(Field("LName") +
       "." + FusionPro.Composition.outputFormatExtension);

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...