View Single Post
Old February 4th, 2016, 02:38 PM
step's Avatar
step step is offline
Senior Contributor
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Composing Several Non-Sequential Records

Originally Posted by JPalchak View Post
What would be really optimal would be a compose records 1,2,3... kind of how a print dialogue box would ask for which pages to print; a range or specific pages (in this case records).
You can do this by creating an array of records you want to compose and then comparing the inputRecordNumber against that array to determine whether a record should be suppressed or not:
var records = [1, 8,'4-6']; // Records to compose

records ={ s = String(s); var [a,b] = s.split('-'); a = Int(a); b = Int(b || a); s = [a]; while (a < b) s.push(++a); return s.join('|'); }).join('|');

FusionPro.Composition.composeThisRecord = new RegExp(records, '').test(FusionPro.Composition.inputRecordNumber);
Note that the order doesn't matter and that you specify a range of records as long as the range is a string (within quotes) otherwise the numbers will just be subtracted. The above code would compose records 1,4,5,6, and 8.

Alternatively it seems like you could only compose records that have a unique back by setting up a global array:
var backs = [];
And then comparing the back to be used for a specific record to the array. If it's not in the array, that means it's unique so compose the record and push it into the array. If it exists in the array, then you can skip that record because you've already composed a record with that back. To me, that seems easier than searching through your data for records to build a "proof" list but I may be missing something.
var back = Field("Back"); // Field to determine which back page to turn on

if (backs.indexOf(back) > -1)
    FusionPro.Composition.composeThisRecord = false;
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

Reply With Quote