Jump to content

Custom Proof output based on data record total


rpaterick

Recommended Posts

Tried to figure out a way to do this in our mailing software but hit a wall.

 

Way to output a file divisible by 5?

 

2 Examples based on sort position or sequence number:

100 records. Customer would then see record 20, 40, 60, 80, and 100 from the sequence order.

600 records. Customer would then see record 120, 240, 360, 480, and 600 from the sequence order.

 

Since it's based on the mail presort file, there would be a SORT POSITION that FusionPro could look at or look at the overall records that are provided.

 

Since it's getting processed on Direct, automating this through FusionPro vs. trying to figure it out in Excel would be worth the time to have FusionPro process the PROOF FILE that gets sent to the customer.

Link to comment
Share on other sites

rpaterick,

 

To be truthful I don't really know how FusionPro Direct works so I am assuming here that it functions the same as Server does via a command line. However you could easily do this on FusionPro Server using the "ExternalDataFileEx" feature in FusionPro. You could also program it in the same template to process the final file using all the records and your "proof file" using only a sub-set of the final data. The second part is accomplished by using the concept of multiple config files for the same template. This will work with the command line function of Server and Direct (I think), but not as easily with Desktop.

 

First in you OnJobStart rule create this...

var myNewFile = new ExternalDataFileEx(FusionPro.Composition.inputFileName, ",");
batchCount = Int(myNewFile.recordCount / 5);

Now in your OnRecordStart code this...

if ((CurrentRecordNumber() % batchCount) != 0)
   FusionPro.Composition.composeThisRecord = false;

This will count the records in the input data file by temporarily creating it as a External Data File and then create a batch size that you have determined that you wanted to be 5 records. This will now let FusionPro know in the OnRecordStart rule which records to skip over and which ones to process.

 

This would answer the base of your question as it stands, but let's continue on with what I mentioned about using multiple config files. On the machine that you have Server (or Direct) running on and after you move your template over to it, you need to create a .cfg file to let FusionPro know how you want to process the file. Nothing states that you need to only have one config file per template. For some of mine I have up to 5. They each refer to the same .def, .dif, and .pdf files but I can put extra codes into these .cfg file to send values to FusionPro and use these codes as triggers inside rules to process certain items or skip others.

 

So if you change the two above rules to be...

if (Int(FusionPro.Composition.JobOptions["Proof"]))  {
   var myNewFile = new ExternalDataFileEx(FusionPro.Composition.inputFileName, ",");
   batchCount = Int(myNewFile.recordCount / 5);
}

and

if (Int(FusionPro.Composition.JobOptions["Proof"]))  {
   if ((CurrentRecordNumber() % batchCount) != 0)
       FusionPro.Composition.composeThisRecord = false;
}

Then these rules on OnJobStart and OnRecordStart will only be triggered when the value of PROOF is an integer. If it is not then the file will process as normal using every record. NOW COMES THE FUN PART. After you create you .cfg file on Server (or Direct), then open it with NotePad or WordPad or some other basic text editor and add the line

Proof=1;

to the very front. This will now assign the integral value of 1 to "Proof". Now save this .cfg file out with a different name such as "mytemplate_proof.cfg".

 

When you send the command line to FusionPro Server (or Direct) simply include the "proof" .cfg file in the string when you want to create the 5 record proof file for the customer to view and then use the base .cfg file when you want to process the final "for print" file with all the records. This way you will not have to program, correct, edit or keep track of two template but just one. The only thing you need to be careful of is when you need to create a new .cfg file, if so much has changed to the template, then you need to remember to create the second "proof" .cfg file as well including your "special coding".

 

Hope this helps.

Good Luck.

.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...