Hello!
I am *very* new to FusionPro and somewhat of a beginner in Javascript, but I have to come up with a demo for a customer creating one of their more complex products (at least to me) in FusionPro to show them it's merits in their daily production.
The product is raffle ticket books. Each book has a personalized front cover, dual numbered tickets with the amount of tickets in each book set at time of order (variable) and a back cover. The cover of each book also has to have "Book x of y" numbering on it.
So, I have a calculation for the total number of books, some "setbodypageusage" loops and then have to produce them as both one file for each book and one file for each order (not at the same time - two different production runs).
The customer wants a totally hands-off production run (we're going to be looking at FusionPro Producer if I can get this to work manually) with each order a separate line in the data file.
I've watched all the training videos, read the entire Rules guide and the User Guide section on rules, and I still can't figure out how to setup the loops.
This is what I've managed to come up with so far:
OnJobStart
FusionPro.Composition.chunksBreakStacks = true;
OnRecordStart
FusionPro.Composition.SetBodyPageUsage(Front, true)
var jobNumber = Field("CompanyName") + "_" + Field("TotalTickets");
var totalBooks = 0;
var ticketsPerBook = Field("TicketsPerBook");
var jobExtension = "." + (FusionPro.Composition.outputFormatExtension || "pdf");
if (FieldChanged("Companyname") || FusionPro.Composition.repeatRecordNumber % couponPerBook == 1)
{
var jobNumber = Field("CompanyName") + "_" + Field("TotalTickets") + "_Book" + Int((FusionPro.Composition.repeatRecordNumber-1) / couponPerBook);
var jobExtension = "." + (FusionPro.Composition.outputFormatExtension || "pdf");
FusionPro.Composition.OpenNewOutputFile(jobNumber + jobExtension);
}
Ticket Number Rule
FusionPro.Composition.composeAllRecords = false;
FusionPro.Composition.startRecordNumber = Field("StartNumber");
FusionPro.Composition.endRecordNumber = Field("TotalTickets");
FusionPro.Composition.repeatRecordCount = Field("TotalTickets");
return FormatNumber ("####", FusionPro.Composition.repeatRecordNumber);
Book Number Rule
var bookTotal = Field("TotalTickets") / Field("TicketsPerBook");
FusionPro.Composition.composeAllRecords = false;
FusionPro.Composition.startRecordNumber = Field("StartNumber");
FusionPro.Composition.endRecordNumber = bookTotal;
FusionPro.Composition.repeatRecordCount = bookTotal;
return FormatNumber ("####", FusionPro.Composition.repeatRecordNumber);
Book Total Rule
var bookTotal = Field("TotalTickets") / Field("TicketsPerBook");
return bookTotal
The sample data is as follows:
CompanyName,TotalTickets,TicketsPerBook,Date,Location,FirstPrize,SecondPrize,ThirdPrize,Price,MultPrice,StartNumber
ABC Company,1500,10,"July 3, 2020","123 Main Street, Anytown","40"" Smart TV",A Case of Mixed Wine,$25 Gas Card,5,20,1
Acme Widgets,2500,25,"August 14, 2020","895 Smith Place, Toytown",Weekend for Two in Las Vegas,"32"" Smart TV",$100 Gift Card,5,20,1
Spacely Sprockets,500,5,"September 7, 2020","999 Jon Street, Cape End",Entertainment Gift Basket,$25 Gas Card,$10 Starbucks Card,1,3,1
Any help will be greatly appreciated!!
Mike