rkury14 Posted November 6, 2019 Share Posted November 6, 2019 I seem to be hitting a wall here with regards to swapping pages on my template. I have a complex dynamic financial statement with charts. I want to swop certain pages so it appears that the charts move up and down. I basically have two versions that potentially will go to four versions. But right now I am dealing with a 11 page document. One version is called GBOO (Green, Blue, Org Student, Org Parent) the other version is GOO. So I have GBOO pages as 1,2,3,4,6,8,10,11 and GOO pages are 1,2,3,5,7,9,10,11 I want to swap the middle pages 4,6,8 with 5,7,9. I have tried different codes based on my research on this forum. Turning all the pages to Unused does not work, it just errors out. So this is what I came up with. if (Field("version") == "GBOO") { FusionPro.Composition.SetBodyPageUsage("GBOO-4",true); FusionPro.Composition.SetBodyPageUsage("GBOO-5",true); FusionPro.Composition.SetBodyPageUsage("GBOO-6",true); } if (Field("version") == "GOO") { FusionPro.Composition.SetBodyPageUsage("GOO-7",true); FusionPro.Composition.SetBodyPageUsage("GOO-8",true); FusionPro.Composition.SetBodyPageUsage("GOO-9",true);} else { FusionPro.Composition.SetBodyPageUsage("GBOO-4",true); FusionPro.Composition.SetBodyPageUsage("GBOO-5",true); FusionPro.Composition.SetBodyPageUsage("GBOO-6",true); } I have attached my template as well. Let me know and I can attached my list as well, but not sure it will help.ASU FAN_GBOO Swop Pages.pdf Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted November 7, 2019 Share Posted November 7, 2019 (edited) Well, I can't really test anything without the data file, but from the template I can see one problem: You have the wrong name for page 4. It's set as "GBOO4" in the Page Usage dialog, but it should be "GBOO-4" to match the rule. As for the rule itself, once you fix that page name, I think this should work: var isGBOO = Field("version") == "GBOO"; FusionPro.Composition.SetBodyPageUsage("GBOO-4", isGBOO); FusionPro.Composition.SetBodyPageUsage("GBOO-5", isGBOO); FusionPro.Composition.SetBodyPageUsage("GBOO-6", isGBOO); FusionPro.Composition.SetBodyPageUsage("GOO-7", !isGBOO); FusionPro.Composition.SetBodyPageUsage("GOO-8", !isGBOO); FusionPro.Composition.SetBodyPageUsage("GOO-9", !isGBOO); Again, though, I can't test this without the data file. By the way, looking at this job, I think you can accomplish what you want without having to swap out pages at all, if you put all the frames that need to move (the chart and such) into a page of type Template, then call out that reusable/repeatable component selectively in one of two text frames, in different positions on the Body page. That's a bit of work to set up initially, but if you have to make changes later, you'll only need to change them in one place instead of two. Edited November 7, 2019 by Dan Korn Quote Link to comment Share on other sites More sharing options...
rkury14 Posted November 7, 2019 Author Share Posted November 7, 2019 Thank you Dan, I will test it out Quote Link to comment Share on other sites More sharing options...
rkury14 Posted November 7, 2019 Author Share Posted November 7, 2019 Dan, Thank you so much!!! This did the trick. I will look into your suggestion. I'm hoping to drive the whole template using the list, so if there are any changes to the list. I wouldn't have to make any changes on the template. Quote Link to comment Share on other sites More sharing options...
rkury14 Posted November 16, 2019 Author Share Posted November 16, 2019 Hi Dan, So now I have to add two more version pages similar to the last two. So I will have a total of 4 versions GBOO, GOO, OO and BOO. I tried adding the page names accordingly but it is not working. Here is the rule you started and I added on to it: var isGBOO = Field("version") == "GBOO"; FusionPro.Composition.SetBodyPageUsage("GBOO-4", isGBOO); FusionPro.Composition.SetBodyPageUsage("GBOO-5", isGBOO); FusionPro.Composition.SetBodyPageUsage("GBOO-6", isGBOO); FusionPro.Composition.SetBodyPageUsage("GOO-7", !isGBOO); FusionPro.Composition.SetBodyPageUsage("GOO-8", !isGBOO); FusionPro.Composition.SetBodyPageUsage("GOO-9", !isGBOO); var isOO = Field("version") == "OO"; FusionPro.Composition.SetBodyPageUsage("OO-10", isOO); FusionPro.Composition.SetBodyPageUsage("OO-11", isOO); FusionPro.Composition.SetBodyPageUsage("OO-12", isOO); FusionPro.Composition.SetBodyPageUsage("BOO-13", !isOO); FusionPro.Composition.SetBodyPageUsage("BOO-14", !isOO); FusionPro.Composition.SetBodyPageUsage("BOO-15", !isOO); else isGBOO = Field("version") == "GBOO"; FusionPro.Composition.SetBodyPageUsage("GBOO-4", isGBOO); FusionPro.Composition.SetBodyPageUsage("GBOO-5", isGBOO); FusionPro.Composition.SetBodyPageUsage("GBOO-6", isGBOO); FusionPro.Composition.SetBodyPageUsage("GOO-7", !isGBOO); FusionPro.Composition.SetBodyPageUsage("GOO-8", !isGBOO); FusionPro.Composition.SetBodyPageUsage("GOO-9", !isGBOO); I appreciate any help on this. Thank you! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted November 18, 2019 Share Posted November 18, 2019 it is not working. Okay.... What is the expected result, and what is the actual result, and exactly how are they different? Here is the rule you started and I added on to it: ... else isGBOO = Field("version") == "GBOO"; ... I don't see what that "else" does. There's no "if" for it to match. I think that will just give you a syntax error. Anyway, with more than two page types, you need more than just a Boolean "yes/no" for each one. I think something like this will work: var isOO = Field("version") == "OO"; var isBOO = Field("version") == "BOO"; var isGOO = Field("version") == "GOO"; var isGBOO = Field("version") == "GBOO"; FusionPro.Composition.SetBodyPageUsage("GBOO-4", isGBOO); FusionPro.Composition.SetBodyPageUsage("GBOO-5", isGBOO); FusionPro.Composition.SetBodyPageUsage("GBOO-6", isGBOO); FusionPro.Composition.SetBodyPageUsage("GOO-7", isGOO); FusionPro.Composition.SetBodyPageUsage("GOO-8", isGOO); FusionPro.Composition.SetBodyPageUsage("GOO-9", isGOO); FusionPro.Composition.SetBodyPageUsage("OO-10", isOO); FusionPro.Composition.SetBodyPageUsage("OO-11", isOO); FusionPro.Composition.SetBodyPageUsage("OO-12", isOO); FusionPro.Composition.SetBodyPageUsage("BOO-13", isBOO); FusionPro.Composition.SetBodyPageUsage("BOO-14", isBOO); FusionPro.Composition.SetBodyPageUsage("BOO-15", isBOO); Quote Link to comment Share on other sites More sharing options...
rkury14 Posted November 19, 2019 Author Share Posted November 19, 2019 (edited) Thank you so much Dan, That worked on all 4 vers as desired. I have attached a pdf of the template and a final pdf of the results. You will see that each ver as their corresponding information and pie charts as desired. Thanks again. Edited December 3, 2019 by rkury14 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.