Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old May 22nd, 2018, 11:40 AM
gdellaiera gdellaiera is offline
Regular Contributor
 
Join Date: Nov 2016
Posts: 78
Default Switching pages with on record start

I am trying to create a banner with a few fields and some size changes based upon one of the fields.

I have 3 sizes for banners (18x12, 60x30, 72x36) based upon the number of years selected
1-5 = 18x12
10-15 = 18x12
20-25 = 60x30
30+ = 72x36

With 3 layouts for the background
Style 1
Style 2
Style 3

The field for "Years of service" is entered in manually while the background is based on a pick list of the 3 styles.

I believe that OnRecordStart would be my best bet for this, but I'm not getting the result I was hoping for.

I have set all pages to "Body, unused" and then I get no records to show. Originally I had all pages set to "Body" and each page displayed, which was not what I was looking for either.

I couldn't find anything that was similar enough for me to build off of on the forum yet, so I decided to post my javascript here and maybe someone would be able to find out what I am missing.

Thanks for the look and any and all help!


var Background = Field("Background");

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


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


if (Field("Years of Service") >=20 && Field("Years of Service")<= 25) + Field("Background") == "Style 1";
return ("Style 1 60x30");


if (Field("Years of Service") >=30 + (Field("Background") == "Style 1"));
return ("Style 1 72x36");


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


if (Field("Years of Service") >=10 && Field("Years of Service")<= 15) + Field("Background") == "Style 2";
return ("Style 2 18x12");


if (Field("Years of Service") >=20 && Field("Years of Service")<= 25) + Field("Background") == "Style 2";
return ("Style 2 60x30");


if (Field("Years of Service") >=30 + (Field("Background") == "Style 2"));
return ("Style 2 72x36");


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


if (Field("Years of Service") >=10 && Field("Years of Service")<= 15) + Field("Background") == "Style 3";
return ("Style 3 18x12");


if (Field("Years of Service") >=20 && Field("Years of Service")<= 25) + Field("Background") == "Style 3";
return ("Style 3 60x30");


if (Field("Years of Service") >=30 + (Field("Background") == "Style 3"));
return ("Style 3 72x36");



switch(Background) {

case "Style 1 18x12":
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);
break;

case "Style 1 60x30":
FusionPro.Composition.SetBodyPageUsage("Style 1 18x12",false);
FusionPro.Composition.SetBodyPageUsage("Style 1 60x30",true);
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);
break;

case "Style 1 72x36":
FusionPro.Composition.SetBodyPageUsage("Style 1 18x12",false);
FusionPro.Composition.SetBodyPageUsage("Style 1 60x30",false);
FusionPro.Composition.SetBodyPageUsage("Style 1 72x36",true);
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);
break;

case "Style 2 18x12":
FusionPro.Composition.SetBodyPageUsage("Style 1 18x12",false);
FusionPro.Composition.SetBodyPageUsage("Style 1 60x30",false);
FusionPro.Composition.SetBodyPageUsage("Style 1 72x36",false);
FusionPro.Composition.SetBodyPageUsage("Style 2 18x12",true);
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);
break;

case "Style 2 60x30":
FusionPro.Composition.SetBodyPageUsage("Style 1 18x12",false);
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",true);
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);
break;

case "Style 2 72x36":
FusionPro.Composition.SetBodyPageUsage("Style 1 18x12",false);
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",true);
FusionPro.Composition.SetBodyPageUsage("Style 3 18x12",false);
FusionPro.Composition.SetBodyPageUsage("Style 3 60x30",false);
FusionPro.Composition.SetBodyPageUsage("Style 3 72x36",false);
break;

case "Style 3 18x12":
FusionPro.Composition.SetBodyPageUsage("Style 1 18x12",false);
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",true);
FusionPro.Composition.SetBodyPageUsage("Style 3 60x30",false);
FusionPro.Composition.SetBodyPageUsage("Style 3 72x36",false);
break;

case "Style 3 60x30":
FusionPro.Composition.SetBodyPageUsage("Style 1 18x12",false);
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",true);
FusionPro.Composition.SetBodyPageUsage("Style 3 72x36",false);
break;

case "Style 3 72x36":
FusionPro.Composition.SetBodyPageUsage("Style 1 18x12",false);
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",true);
break;


}
Reply With Quote
 

Tags
fusion pro, javascript, onrecordstart

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:36 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.