mclisa81 Posted March 16, 2011 Posted March 16, 2011 Hi, This is only a piece of my OnRecordStart rule that I'm having trouble with. I'm trying to simplify a template that I created quite awhile ago that has become quite "messy". I have many pages in this template that are turned on by the OnRecordStart rule and I need certain pages to repeat based on a count in the data. if (Field("Qty710Score") != "") { FusionPro.Composition.SetBodyPageUsage("Notecard1", true); FusionPro.Composition.SetBodyPageUsage("Notecard1b", true); } What I need is these 2 pages to repeat based on a count in Qty710Score. I've enclosed a mocked up output of what it would look like if it Qty710Score had a quantity of "10". I don't want the whole record repeated, just certain pages. Thanks, Lisatest-Output2.pdf
esmith Posted March 16, 2011 Posted March 16, 2011 If I understand correctly, I think you would just add another line to your callback rule: FusionPro.Composition.repeatRecordCount = Field("Qty710Score"); Your IF statement tells FP which unused pages to activate and the line above tells FP how many copies to make of the activated pages. (Note: Depending on how your data is set up, you may need to put the repeatRecordCount line INSIDE your IF statement so that it does not run when the field is empty.)
mclisa81 Posted March 16, 2011 Author Posted March 16, 2011 Hi Eric, Thanks for the quick reply. I tried the RepeatRecordCount previously, but that's not what I'm looking for, unless I did it incorrectly. I don't want the whole record to repeat, just certain pages based on a count in the data. I've built a dummy template of what I have so far, that I'll upload along with a pdf called "DesiredOutput" which is an example of the output I'm trying to achieve with the txt file I've uploaded (right now with my rule, I'm only getting 1 of each page to print). The Coversheets print once with each record. The remaining pages may or may not print depending on the count supplied in the data. You'll probably get an error about PS command that you can ignore since I have the pages set up for tray pulls at our IGEN.ArtStamps_template_revised_NEW_piece.pdftest.txtDesiredOutput.pdf
mclisa81 Posted March 18, 2011 Author Posted March 18, 2011 Does anyone have any ideas? I've been working on this for the past 3 days and I'm not sure if what I want to accomplish is even possible (although I'm sure it is, but I'm unsure of how to do it). If I'm unclear on what I'm looking for please let me know. Thanks Lisa
ddaleki Posted March 19, 2011 Posted March 19, 2011 This is the code that I use to print a base run slipsheet overs and slipsheet. It is the end of my day, but this is the code and have your way with it. var totalQty = StringToNumber(Field("Qty Ordered")) + StringToNumber(Field("Overs")); FusionPro.Composition.repeatRecordCount = totalQty; if (FusionPro.Composition.repeatRecordNumber <= Field("Qty Ordered")) { FusionPro.Composition.SetBodyPageUsage("A", true); if (FusionPro.Composition.repeatRecordNumber == Field("Qty Ordered")) { FusionPro.Composition.SetBodyPageUsage("B", true); } } if (FusionPro.Composition.repeatRecordNumber > Field("Qty Ordered")) { FusionPro.Composition.SetBodyPageUsage("A", false); FusionPro.Composition.SetBodyPageUsage("B", false); FusionPro.Composition.SetBodyPageUsage("C", true); if (FusionPro.Composition.repeatRecordNumber == totalQty) { FusionPro.Composition.SetBodyPageUsage("D", true); } }
jrich Posted March 28, 2011 Posted March 28, 2011 I have tried to use this as a template to get the project I am working on to print properly, but I think I am missing something. I am new to FusionPro and not very familiar with programming, especially in JavaScript. I have a list of names and then how many of each type of page I want to print for each person. I want FusionPro to print the number of pages based on the quantity in the data file. Is there more needed than just what is listed in the thread? Any help would be greatly appreciated. Thank you.
Dan Korn Posted March 28, 2011 Posted March 28, 2011 Try this: var Qty710Score = Int(Field("Qty710Score")); var Qty710PerfPC = Int(Field("Qty710PerfPC")); var Qty710PerfCP = Int(Field("Qty710PerfCP")); var QtySEAL = Int(Field("QtySEAL")); var total = Qty710Score + Qty710PerfPC + Qty710PerfCP + QtySEAL; FusionPro.Composition.repeatRecordCount = total; var thisRepeat = FusionPro.Composition.repeatRecordNumber; switch (thisRepeat) { case 1: case Qty710Score + 1: case Qty710Score + Qty710PerfPC + 1: case Qty710Score + Qty710PerfPC + Qty710PerfCP + 1: Print(thisRepeat + ": Cover"); FusionPro.Composition.SetBodyPageUsage("CoverSheet", true); FusionPro.Composition.SetBodyPageUsage("CoverSheetp2", true); break; default: FusionPro.Composition.SetBodyPageUsage("CoverSheet", false); FusionPro.Composition.SetBodyPageUsage("CoverSheetp2", false); } if (Qty710Score && thisRepeat <= Qty710Score) { Print(thisRepeat + ": Notecard"); FusionPro.Composition.SetBodyPageUsage("Notecard1", true); FusionPro.Composition.SetBodyPageUsage("Notecard1b", true); } else if (Qty710PerfPC && thisRepeat <= Qty710Score + Qty710PerfPC) { Print(thisRepeat + ": Postcard"); FusionPro.Composition.SetBodyPageUsage("Postcard1_", true); FusionPro.Composition.SetBodyPageUsage("Postcard1b_", true); } else if (Qty710PerfCP && thisRepeat <= Qty710Score + Qty710PerfPC + Qty710PerfCP) { Print(thisRepeat + ": Commermative5x7"); FusionPro.Composition.SetBodyPageUsage("Commermative5x71", true); FusionPro.Composition.SetBodyPageUsage("Commermative5x71b", true); } else { Print(thisRepeat + ": Seals1"); FusionPro.Composition.SetBodyPageUsage("Seals1F", true); FusionPro.Composition.SetBodyPageUsage("Seals1B", true); }
jrich Posted March 28, 2011 Posted March 28, 2011 Thank you for the further code. I was just wondering if there was a way to not print anything at all if the number in the data file was zero. In other words, they do not want any of that document.
Dan Korn Posted March 28, 2011 Posted March 28, 2011 Thank you for the further code. I was just wondering if there was a way to not print anything at all if the number in the data file was zero. In other words, they do not want any of that document. The logic I posted should properly handle the condition where the count for one or more documents (front-back pairs of pages) is zero.
jrich Posted April 1, 2011 Posted April 1, 2011 The only problem I see with this is that I might need multiple copies of each flier. The code will print only one of the different version....Right? I found a way to manipulate the csv file so that it is easier to write FusionPro rules for it.
Dan Korn Posted April 1, 2011 Posted April 1, 2011 The only problem I see with this is that I might need multiple copies of each flier. The code will print only one of the different version....Right? No, it outputs the specified number of each flier (front-back page pair). Did you try it? It works great for me. I found a way to manipulate the csv file so that it is easier to write FusionPro rules for it. Okay, if that's easier for you, then great. But what I posted does seem to solve the problem as I understand it.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.