PDA

View Full Version : Page selection


kopytekinc
December 7th, 2009, 08:14 AM
I have reviewed several of the samples provided as well as dug through the javascript manual for FP but am still struggling getting the page selection dependent on a variable set.

Below is my script My pages are set to (coBorrowFront, coBorrowBack, borrowFront, and borrowBack) each front back used in conjunction with each other. (All pages are currently set to unused) The field I am using to determine which pages is called ID_ALR, where 3 = the borrow pages and 4 = the coborrow pages. When I compose right now I am just testing using a single case for 4 and getting only 2 backs one coBorrowBack and one borrowBack.

if (Field("ID_ALR") == "4")
{
FusionPro.Composition.SetBodyPageUsage("coBorrowFront",true);
FusionPro.Composition.SetBodyPageUsage("coBorrowBack",true);
}
else if (Field("ID_ALR") == "3")
{
FusionPro.Composition.SetBodyPageUsage("borrowFront",true);
FusionPro.Composition.SetBodyPageUsage("borrowBack",true);
}
else
ReportError("Can't set pages for BirthdayCard: " + Field("ID_ALR"));

Thanks for your help in advance

esmith
December 7th, 2009, 09:01 AM
I like to set my page names equal to the data, so in your case, I would name my pages to 3-front, 3-back, 4-front and 4-back, and set all of them to be unused. Then in your OnRecordStart rule you could try the following:
FusionPro.Composition.SetBodyPageUsage(Field("ID_ALR") + "-front",true);
FusionPro.Composition.SetBodyPageUsage(Field("ID_ALR") + "-back",true);
Make sure you named your pages correctly in the ManagePages dialog -- your original results may just be that you have your pages ordered incorrectly. :)

kopytekinc
December 7th, 2009, 10:00 AM
mr esmith, I had actually found your post in the forums for another post and used it verbatim even changing my variables to match yours, only to realize there was a naming issue, all is good. Thanks for your help =]