Jump to content

Repeating Sequential Ranges Rule


Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 11 months later...

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

Link to comment
Share on other sites

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;

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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);

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...