WBG-guy Posted March 15, 2012 Share Posted March 15, 2012 I'm not sure if I'm doing this correctly which is why I'm here asking. I have a 20 page catalog that I'm using "onrecordstart" rule that turns on pages as they request within the template on MCC. Page: Pg1 is on and Pg2-20 are off. On MarcomCentral template I have a field "Page1-19" that they say yes and the following page turns on. Here's the rule that I created within onrecordstart, can you confirm its correct or is there a better way to do this? if (Field("page1") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg2",true); if (Field("page2") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg3",true); if (Field("page3") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg4",true); if (Field("page4") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg5",true); if (Field("page5") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg6",true); if (Field("page6") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg7",true); if (Field("page7") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg8",true); if (Field("page8") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg9",true); if (Field("page9") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg10",true); if (Field("page10") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg11",true); if (Field("page11") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg12",true); if (Field("page12") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg13",true); if (Field("page13") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg14",true); if (Field("page14") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg15",true); if (Field("page15") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg16",true); if (Field("page16") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg17",true); if (Field("page17") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg18",true); if (Field("page18") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg19",true); if (Field("page19") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg20",true); Link to comment Share on other sites More sharing options...
Dan Korn Posted March 15, 2012 Share Posted March 15, 2012 I'm not sure if I'm doing this correctly which is why I'm here asking. I have a 20 page catalog that I'm using "onrecordstart" rule that turns on pages as they request within the template on MCC. Page: Pg1 is on and Pg2-20 are off. On MarcomCentral template I have a field "Page1-19" that they say yes and the following page turns on. Here's the rule that I created within onrecordstart, can you confirm its correct or is there a better way to do this? if (Field("page1") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg2",true); if (Field("page2") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg3",true); // ... snip ... if (Field("page19") == "Yes") FusionPro.Composition.SetBodyPageUsage("pg20",true); That will probably work, but you could do all that in just a couple lines of code using a loop, like so: for (var i = 1; i <= 19; i++) FusionPro.Composition.SetBodyPageUsage("pg" + (i + 1), Field("page" + i) == "Yes"); Link to comment Share on other sites More sharing options...
WBG-guy Posted March 15, 2012 Author Share Posted March 15, 2012 Wow! Using a loop really makes sense. I will trying it out to see how it goes. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.