Hadrian Posted May 2, 2012 Share Posted May 2, 2012 Trying to compose a series of records in the same order as the output file being generated but i keep getting "Could not write output file </Users/me/Desktop/Support Files/Table Generators/Brochure Tables/PDFs/BN08890-16#NY11 CEL BPS 10K BRO.pdf>." Anyone see the issue here? //OnJobStartRule t = ["10K 14K","10K 14K 18K", "BPS 10K 14K", "CEL 10K 14K", "CEL BPS 10K"]; for (i = 0; i < t.length; i++){ metal = t[i]; } //NewOutputFileName if (FusionPro.inValidation) Rule("OnJobStart"); asset = Field("Account").replace(/\//gi, "#"); FusionPro.Composition.outputFileName = asset + " " + metal + " " + "BRO" + ".pdf"; //Table Rule if (FusionPro.inValidation) Rule("OnJobStart"); return generateMarkup(Field("School"), metal); Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted May 2, 2012 Share Posted May 2, 2012 (edited) What are you trying to do here? //OnJobStartRule t = ["10K 14K","10K 14K 18K", "BPS 10K 14K", "CEL 10K 14K", "CEL BPS 10K"]; for (i = 0; i < t.length; i++){ metal = t[i]; }This code is called exactly once at the start of the job, and after the iteration, the value of the variable "metal" is set to the last string in the array ("CEL BPS 10K"). So it's trying to write the same output file every time. If you want to reference a different value from the array for each record, you would need do something like this in a per-record rule: metal = t[FusionPro.Composition.processedRecordNumber - 1]; Edited May 2, 2012 by Dan Korn Quote Link to comment Share on other sites More sharing options...
Hadrian Posted May 4, 2012 Author Share Posted May 4, 2012 I am trying to make it compose one metal file per array value. Example: ***XX 10K 14K BRO.pdf ***XX 10K 14K 18K BRO.pdf ***XX BPS 10K 14K BRO.pdf Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted May 4, 2012 Share Posted May 4, 2012 I am trying to make it compose one metal file per array value. Example: ***XX 10K 14K BRO.pdf ***XX 10K 14K 18K BRO.pdf ***XX BPS 10K 14K BRO.pdf Get rid of the OnJobStart rule and do this in OnNewOutputFile: var asset = Field("Account").replace(/\//gi, "#"); var t = ["10K 14K","10K 14K 18K", "BPS 10K 14K", "CEL 10K 14K", "CEL BPS 10K"]; var metal = t[FusionPro.Composition.currentOutputFileNumber - 1]; FusionPro.Composition.outputFileName = asset + " " + metal + " " + "BRO" + ".pdf"; 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.