LyndaEngelage Posted June 9, 2022 Share Posted June 9, 2022 I need a rule for Sequential numbering in ranges of 6 increments that repeats until a specified range ending (1001-146000). I will use a Overflow template until the pages are filled with the repeating range. How do I repeat the rule on the same page until it's filled within the text box? for example: 1001-1006 1007-1012 1013-1018 etc. filling the rest of the page down, then overflow to the next page and continue where it left off. My current Sequential Incremental Rule looks like this: var start_number = 1001; var increment = 6; var crn = CurrentRecordNumber() -1; var set_start = start_number +crn +(crn * increment); var set_end = set_start + increment; return set_start + "-" + set_end Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted June 10, 2022 Share Posted June 10, 2022 Give this a shot: var start_number = 1001; var largest_number = 146000; var range = 5; var sequence = ""; while (start_number +range <= largest_number) { sequence += start_number + "-" + (start_number +range) + '<br>'; start_number += (range +1); } return sequence; Quote Link to comment Share on other sites More sharing options...
LyndaEngelage Posted June 10, 2022 Author Share Posted June 10, 2022 Thomas, Thank you for your reply. That worked great! but I had to change the range to 4 to make it work the range I needed. For some reason when I compose the job all the pages turn out the same and not continuous. I have the Text frame on the body page marked as overflow and the 2nd page set up as an Overflow template. I have attached my collected file. Can you take a look and see what I'm not doing correctly?158789-1_Log_Book_FP.zip Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted June 10, 2022 Share Posted June 10, 2022 You need to remove the rule from the text frame on the overflow page, then in the text frame properties palatte, turn on the checkbox that says "Overflow To". Also in your Composition Settings under Input, change the Record Range to All or 1 to 1. Quote Link to comment Share on other sites More sharing options...
LyndaEngelage Posted June 14, 2022 Author Share Posted June 14, 2022 Thank you very much. It works great now. I was missing the checked box on the Overflow template. I appreciate your help!! Quote Link to comment Share on other sites More sharing options...
LyndaEngelage Posted June 15, 2022 Author Share Posted June 15, 2022 I ran into a snag. I need to edit the rule to include tabs, but when I do and send to compose the server gets to 95% done and just hangs. I let it set all night but it didn't complete. It looks fine in the preview. Is there an easier or more efficient way to put tab stops in the rule. I have the tab stops defined in the text editor, under the tabs. I have also attached my revised setup with a screenshot of the preview. Here's my rule with the tab tags added: var start_number = 6001; var largest_number = 87000; var range = 4; var sequence = ""; while (start_number +range <= largest_number) { sequence += start_number + "<t>-<t>" + (start_number +range) + '<br>' + "<t>"; start_number += (range +1); } return sequence;158789-1_WIC_Log_Book_FP.zip Quote Link to comment Share on other sites More sharing options...
LyndaEngelage Posted June 16, 2022 Author Share Posted June 16, 2022 Just a Note… To try to simplify things, I tried to make two separate rules to overflow (getting rid of the tabs), but apparently you can't Overflow to two text frames onto the "Overflow" template Page. Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted June 16, 2022 Share Posted June 16, 2022 I am having the same issues at 95% I think the amount of overflow going on just may be too much to handle. I took a different approach. Removed the overflow completely and moved everything into OnRecordStart. Take a look.158789-1_WIC_Log_Book_FP.pdf Quote Link to comment Share on other sites More sharing options...
LyndaEngelage Posted June 16, 2022 Author Share Posted June 16, 2022 That worked perfectly, thank you very much!! Quote Link to comment Share on other sites More sharing options...
LyndaEngelage Posted May 25 Author Share Posted May 25 I'm coming back to this project a year later. I have a question. When I compose the "log book" pages, it doesn't fill out the last page with the remaining range that is in the On Record Start Rule. It stops at page 22. There should have been one more page with the remaining ranges. Does it have to do with the var lines_per_sheet? Any Ideas? I have attached my collected project. Mac OS Monterery InDesign 2022 AcrobatPro 2022.003.20258 FusionPro Designer 12.1.3 On Record Start Rule: var start_number = 93001; var largest_number = 95700; var range_between = 5; var lines_per_sheet = 20; var iterate = (FusionPro.Composition.outputRecordNumber -1) * (lines_per_sheet * (range_between +1)); var sequence = ""; for (i = 0; i < lines_per_sheet; i++) { sequence += "<t>" + (start_number + iterate) + "<t>-<t>" + (start_number +iterate +range_between) + "<br>"; start_number += (range_between +1); } FindTextFrame("numbers").content = sequence; FusionPro.Composition.repeatRecordCount = ((largest_number -start_number +1) / (lines_per_sheet * (range_between +1))) +1; 167888-1_WIC_Log_Bk1_Adams_FP.zip Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted May 25 Share Posted May 25 I reworked this a little bit to work with your data file. var begin = Int(Field("Begin").replace(",", "")); var end = Int(Field("End").replace(",", "")); var range_between = 5; var lines_per_sheet = 20; var iterate = (FusionPro.Composition.outputRecordNumber -1) * (lines_per_sheet * (range_between +1)); var sequence = ""; var start_number = begin; for (i = 0; i < lines_per_sheet; i++) { sequence += "<t>" + (start_number + iterate) + "<t>-<t>" + (start_number +iterate +range_between) + "<br>"; start_number += (range_between +1); } FindTextFrame("numbers").content = sequence; FusionPro.Composition.repeatRecordCount = Math.ceil((end -begin) / ((range_between +1) * lines_per_sheet)); Also, if you rename your page frame to "page" you can run the entire data set and get them all in 1 PDF. Just add this to the bottom of the code: FindTextFrame("page").content = "Page " + FusionPro.Composition.repeatRecordNumber; Quote Link to comment Share on other sites More sharing options...
LyndaEngelage Posted May 26 Author Share Posted May 26 Thanks for the reply. One thing though, it doesn't stop at the "End" number in the data. What I'm actually needing is for each Location to start a new pdf. For example. When Adams County Health Department ends with 23 pages, a pdf is created and a new pdf is started with Boone filling the 45 pages with the range of 95701-95706 to 101095-101100, and down the list of rows of data. I revised my files, do you know why the "Adams" location doesn't end with 95700 (or specifically 95695 - 95700)? The next Record "Boone" doesn't start with 95701 either. 167888-1_WIC_Log_Bk_FP.zip Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted May 26 Share Posted May 26 I think this should do it: var begin = Int(Field("Begin").replace(/\D/g, "")); var end = Int(Field("End").replace(/\D/g, "")); var range_between = 5; var lines_per_sheet = 20; var iterate = (FusionPro.Composition.repeatRecordNumber -1) * (lines_per_sheet * (range_between +1)); var sequence = ""; var start_number = begin; var ending_number = 0; for (i = 0; i < lines_per_sheet && ending_number < end; i++) { sequence += "<t>" + (start_number + iterate) + "<t>-<t>"; ending_number = (start_number +iterate +range_between); if (ending_number > end) ending_number = end; sequence += ending_number + "<br>"; start_number += (range_between +1); } FindTextFrame("numbers").content = sequence; FusionPro.Composition.repeatRecordCount = Math.ceil((end -begin) / ((range_between +1) * lines_per_sheet)); if (FusionPro.Composition.repeatRecordNumber == 1) FusionPro.Composition.OpenNewOutputFile(Field("Location").replace(/[^A-Za-z0-9 -]/g, "") + "_impo" + "." + FusionPro.Composition.outputFormatExtension); Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted May 26 Share Posted May 26 Just realized the page numbers are off. You'll need to change «$outputrecordnumber» to «$repeatrecordnumber» in the page frame. Quote Link to comment Share on other sites More sharing options...
LyndaEngelage Posted Tuesday at 02:49 PM Author Share Posted Tuesday at 02:49 PM Thank you, Thank you!! Works great. 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.