View Single Post
Old May 22nd, 2018, 02:50 PM
scotts scotts is offline
Junior Community Member
Join Date: Feb 2011
Location: Zeeland, MI, USA
Posts: 41
Default Re: Switching pages with on record start

Originally Posted by gdellaiera View Post
I am trying to create a banner with a few fields and some size changes based upon one of the fields.

var Background = Field("Background");

if (Field("Years of Service") >=1 && Field("Years of Service")<= 5) + Field("Background") == "Style 1";
return ("Style 1 18x12");

switch(Background) {

case "Style 1 18x12":


Just looking at this part, your variable "Background" is always going to equal the Field("Background"), so the switch will never work. Let's say Field("Background") is equal to "18x12", and you are trying to make the variable to equal the return of your 'if' statement, correct.

You could change your variable to be...
var Style1A = "Style 1 18x12";
var Style1B = "Style 1 18x12";
And your return to be...
if (Field("Years of Service") >=1 && Field("Years of Service")<= 5) + Field("Background") == "Style 1";
    return Style1A;

if (Field("Years of Service") >=10 && Field("Years of Service")<= 15) + Field("Background") == "Style 1";
    return Style1B;
And your SetBodyPageUsage to be...without the switch
case "Style1A":
        FusionPro.Composition.SetBodyPageUsage("Style 1 18x12",true);
        FusionPro.Composition.SetBodyPageUsage("Style 1 60x30",false);
        FusionPro.Composition.SetBodyPageUsage("Style 1 72x36",false);
        FusionPro.Composition.SetBodyPageUsage("Style 2 18x12",false);
        FusionPro.Composition.SetBodyPageUsage("Style 2 60x30",false);
        FusionPro.Composition.SetBodyPageUsage("Style 2 72x36",false);
        FusionPro.Composition.SetBodyPageUsage("Style 3 18x12",false);
        FusionPro.Composition.SetBodyPageUsage("Style 3 60x30",false);
        FusionPro.Composition.SetBodyPageUsage("Style 3 72x36",false);
Hope this helps.
Reply With Quote