I believe that you might need to use the following original post from Dan
Korn and a later re-post from David Sweet .

Date: Fri, 17 Nov 2006 13:31:01 -0600
Author: "Dan Korn" <[EMAIL PROTECTED]>
Subject: RE: Splitting Records based on a Field in the data Body:

> Is it possible to split a Composed job
> based on a field in the data and
> have the resulting PDF's named using that field.

Sorry for the delay in responding. I had to do some investigation on
this one. The answer is that, yes, it's possible. There are several steps

First, check the "Output to multiple files" box on the Output tab of the
Composition Settings dialog and set the number of records to 1. Then,
create the OnNewOutputFile callback rule and, in it, set the
FusionPro.Composition.outputFileName (or
FusionPro.Composition.outputFileFullPathName) property, like so:

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

Change the field name as appropriate for your data. If you compose
thusly, you will see that you get one output file for each account

However, you'll only get one record's worth of data in each output file.
So we need to compile data from multiple records to create a single
output file for all the records pertaining to each account holder. This
is where you can use an ExternalDataFileEx object to look ahead for data
from other records. You can see an example of this under "How to return
multiple records in the same output file" in the FusionPro Rules Editor
Reference Guide.

If you really want to have separate output pages within each
account-holder specific output file for each input record, then you will
need to do something a little bit different than in the example. My advice
is to create a routine in OnJobStart to read in the original data file and
create a new one with record "chunks" of specific sizes, which you can
then use as your input file for the composition. In other words, you'll
create, say, a hundred records for each account-holder, but only the
number of actual records from your original input file will contain data,
and the rest will be empty. You can then put some logic into OnRecordStart
to set FusionPro.Composition.composeThisRecord = false for the extra empty
records in each output file chunk. Set the number of records per output
file in the Composition Settings to the same number of records you're
creating for each account-holder, including the empty records.

We are looking into adding the ability to start a new output file at any
given time through JavaScript, without having to rework your input file,
in a future version. But you'll have to use a strategy like the one
outlined above for now.



The second part of this response deals more with your request. Take a look
at your data, and figure out the largest output "group" that you would
have. Then adjust the ExternalDataFileEx file Dan refers to earlier in
this posting, and allow for an even amount more than that record size.

Take a look at the example in the KnowledgeBase for "repeat a Given Record
a Number of Times" to give you a good example of how to create an External
data file.

In your OnRecordStart during composition, you would have something like..

if (Field("field_name") == "")
FusionPro.Composition.composeThisRecord = false;

This will skip any of your blank records.

In your OnNewOutputFile you would set the name of that output file..

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


David Sweet
Variable Pre-Press
Consolidated Graphics Group, Inc.

What used for mine was one  OnNewOutput File rule and an OnRecordStart

//OnNewOutput File
//You can use a CurrentRecordNumber function or get a specific field value
//CurRec = CurrentRecordNumber();

Data =  new ExternalDataFileEx("CAData.csv", ",");
Name = Data.GetFieldValue(2, "0");

FusionPro.Composition.outputFileName = "Group" + Name + ".pdf";

// say you only want the group "GroupA" on your database to compose and
skip the other records

if (Field("GroupName") != "GroupA")
FusionPro.Composition.composeThisRecord = false;

I may be going about this the wrong way but it seemed to work for me.



Calling all FP Web Users!

Do you have a question or lots of knowledge to share about FusionPro Web?

If so, join our Printable Web to Print Users' Forum today!

Send email to [EMAIL PROTECTED] to find out how! 

Users of FusionPro Desktop have unlimited free email support. Contact Printable 
View FusionPro Knowledge Base, FusionPro Samples at

You are currently subscribed to fusionpro as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Note:  All e-mail sent to or from this address will be received or otherwise 
recorded by the e-mail recipients of this forum. It is subject to archival, 
monitoring or review by, and/or disclosure to someone other than the recipient. 
Our privacy policy is posted on www.printplanet.com

Reply via email to