solutionsthinknovus.com Posted October 15, 2013 Share Posted October 15, 2013 I have 3 templates (1 is attached) each of which uses the same code in the following: JavaScript Globals OnRecordEnd OnRecordStart txtRule_BuildPrintPDF What is the best way to consolidate this code so that it resides in only 1 place? I was able to use the Load function to load an external file that contained the JavaScript Globals within OnJobStart rule, however, I'm concerned that the Global variables and constants are not going to work as intended. In addition, I would like to do something similar with the OnRecordStart, etc, but again, I'm concerned about the Global variables that are being referenced within those rules.18x12_fp_Code_r5.pdf Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 15, 2013 Share Posted October 15, 2013 If you call the Load function in your JavaScript Globals, then any global variables in the .js script file will be global in the context of the job. That said, I'm not sure you need all that code in the first place to chunk the output to multiple files. I think you can accomplish most of what you need by simply doing this in OnRecordStart: if (FieldChanged("territoryid")) { FusionPro.Composition.OpenNewOutputFile( FormatNumber("00000", FusionPro.Composition.recordNumberInChunk) + "_File-" + FusionPro.Composition.outputRecordNumber + "_UPS-" + Trim(Field("ZoneCode")) + "_PRINT_QTY-" + Trim(Field("quantity")) + "_TERR-" + Trim(Field("territoryid")) + "_" + "_TOTAL_PIECES-" + Trim(Field("TotalPieces")) + "_" + Trim(Field("FirstName")) + "_" + Trim(Field("lastname")) + "." + FusionPro.Composition.outputFormatExtension); } And instead of setting a CUTTER_STACK_BREAK variable in the code, you can check the "Output to multiple files" box on the Output tab of the Composition Settings and set the maximum number of records you want in each output file. Or, you can set FusionPro.Composition.chunksBreakStacks = true in OnJobStart and set the stack size in FP Imposer. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.