Mike
October 19th, 2010, 09:54 PM
Eric has been kind enough to help me work out the following age based code and I have to say it works brilliantly to turn on and off the back pages only for printing.
My question is how would I tell fusion to turn on and off both a front page and a back page. I am a noob and just can't get it to work. Below is the code that works perfect
Code that works:
// OnRecordStart
Date.prototype.YearsBetween = function(){
var intMilYear = 365.23 * 24 * 60 * 60 * 1000;
var intMilDif = arguments[0] - this;
var intYears = Math.floor(intMilDif/intMilYear);
return intYears;
}
var dob = new Date(Field("birthday")); // YOUR FIELD in a standard date format
var today = new Date();
var yearsBetween = dob.YearsBetween(today);
// Turn on age related backs for specific record (Pages named A,B,C,D and set to Unused)
if (yearsBetween <=16) FusionPro.Composition.SetBodyPageUsage("BackA",true);
else if (yearsBetween <= 40) FusionPro.Composition.SetBodyPageUsage("BackB",true);
else if (yearsBetween <= 60) FusionPro.Composition.SetBodyPageUsage("BackC",true);
else FusionPro.Composition.SetBodyPageUsage("BackD",true);
What I need help with in red
// OnRecordStart
Date.prototype.YearsBetween = function(){
var intMilYear = 365.23 * 24 * 60 * 60 * 1000;
var intMilDif = arguments[0] - this;
var intYears = Math.floor(intMilDif/intMilYear);
return intYears;
}
var dob = new Date(Field("birthday")); // YOUR FIELD in a standard date format
var today = new Date();
var yearsBetween = dob.YearsBetween(today);
// Turn on age related backs for specific record (Pages named A,B,C,D and set to Unused)
if (yearsBetween <=16) FusionPro.Composition.SetBodyPageUsage("BackA",true) + FusionPro.Composition.SetBodyPageUsage("FrontA",true);
else if (yearsBetween <= 40) FusionPro.Composition.SetBodyPageUsage("BackB",true) + FusionPro.Composition.SetBodyPageUsage("FrontB",true);
;
else if (yearsBetween <= 60) FusionPro.Composition.SetBodyPageUsage("BackC",true)+ FusionPro.Composition.SetBodyPageUsage("FrontC",true);
;
else FusionPro.Composition.SetBodyPageUsage("BackD",true) + FusionPro.Composition.SetBodyPageUsage("FrontD",true);
;
Any help would be great.
My question is how would I tell fusion to turn on and off both a front page and a back page. I am a noob and just can't get it to work. Below is the code that works perfect
Code that works:
// OnRecordStart
Date.prototype.YearsBetween = function(){
var intMilYear = 365.23 * 24 * 60 * 60 * 1000;
var intMilDif = arguments[0] - this;
var intYears = Math.floor(intMilDif/intMilYear);
return intYears;
}
var dob = new Date(Field("birthday")); // YOUR FIELD in a standard date format
var today = new Date();
var yearsBetween = dob.YearsBetween(today);
// Turn on age related backs for specific record (Pages named A,B,C,D and set to Unused)
if (yearsBetween <=16) FusionPro.Composition.SetBodyPageUsage("BackA",true);
else if (yearsBetween <= 40) FusionPro.Composition.SetBodyPageUsage("BackB",true);
else if (yearsBetween <= 60) FusionPro.Composition.SetBodyPageUsage("BackC",true);
else FusionPro.Composition.SetBodyPageUsage("BackD",true);
What I need help with in red
// OnRecordStart
Date.prototype.YearsBetween = function(){
var intMilYear = 365.23 * 24 * 60 * 60 * 1000;
var intMilDif = arguments[0] - this;
var intYears = Math.floor(intMilDif/intMilYear);
return intYears;
}
var dob = new Date(Field("birthday")); // YOUR FIELD in a standard date format
var today = new Date();
var yearsBetween = dob.YearsBetween(today);
// Turn on age related backs for specific record (Pages named A,B,C,D and set to Unused)
if (yearsBetween <=16) FusionPro.Composition.SetBodyPageUsage("BackA",true) + FusionPro.Composition.SetBodyPageUsage("FrontA",true);
else if (yearsBetween <= 40) FusionPro.Composition.SetBodyPageUsage("BackB",true) + FusionPro.Composition.SetBodyPageUsage("FrontB",true);
;
else if (yearsBetween <= 60) FusionPro.Composition.SetBodyPageUsage("BackC",true)+ FusionPro.Composition.SetBodyPageUsage("FrontC",true);
;
else FusionPro.Composition.SetBodyPageUsage("BackD",true) + FusionPro.Composition.SetBodyPageUsage("FrontD",true);
;
Any help would be great.