tou Posted May 10, 2016 Share Posted May 10, 2016 I current working on splitting a file out in OnRecordStart callback rule and was wondering why the FusionPro.Composition.currentOutputFileNumber value doesn't actually jump correctly the first time up. In output settings, I'm processing the entire range. I've set the following in OnJobStart: .........codeStart............ FusionPro.Composition.chunksBreakStacks = true; .........codeEnd............ I've set the following in OnRecordStart: .........codeStart............ if (FieldChanged("Order_Number")) { FusionPro.Composition.StartNewStack() FusionPro.Composition.OpenNewOutputFile(Field("Product_Desc") + "_" + Field("Order_Number") + "_" + FormatNumber("0000", FusionPro.Composition.currentOutputFileNumber) + "."+ FusionPro.Composition.outputFormatExtension); } .........codeEnd............ Attached is a snapshot of my PDF files....note the **0001.pdf in the first two filenames. I'm sorry in advance if this issue has been resolved in other posts. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted May 10, 2016 Share Posted May 10, 2016 It's possible that setting FusionPro.Composition.chunksBreakStacks = true in a stacked imposition job results in an off-by-one error in the output file (chunk) number counting. Is it correct if you don't set that? I could debug this with the job files, or with a minimal example that demonstrates the problem. As a workaround, you can always just declare a counter variable in the JavaScript Globals and increment it in your OnRecordStart call. Quote Link to comment Share on other sites More sharing options...
tou Posted May 10, 2016 Author Share Posted May 10, 2016 I've modified the following and seems to work.....looks like nesting the filename values into the OpenNewOutputFile() function within OnRecordStart must have a lapsed error or system variable for the file part number not transferring right away..... OnRecordStart: if (FieldChanged("Order_Number")) { FusionPro.Composition.StartNewStack() FusionPro.Composition.OpenNewOutputFile() } OnNewOutputFile: FusionPro.Composition.OpenNewOutputFile(Field("Product_Desc") + "_" + Field("Order_Number") + "_" + FormatNumber("0000", FusionPro.Composition.currentOutputFileNumber) +"."+ FusionPro.Composition.outputFormatExtension); I've tested the above with both checking and not checking the "output to multiple files" and was successful. It was still able to split correctly if I have a quantity less than the split amount (for example, split amount is 100, but only 25 exist in some of these chunks - the OnRecordStart rule that has FieldChange() will honor to the next chunk of 100 records if it has it). I think we're good now. Just had to poke around with it. Thanks! 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.