heather-grzybowski Posted February 27, 2023 Share Posted February 27, 2023 I have a template that has several body pages that are included/excluded based on a simple yes/no fields. Some have multiple pages that would be included based on a Yes and some have only one. I've set all of the body pages to Unused. The only one that does work is the first one - "TeamSlide" but that has a Used and Unused page reference. The rest do not produce any pages with a "Yes" answer. I get no errors in my expression. All are using the same drop-down library so the Yes matches for all answers and is capped Y. Any help would be appreciated. Thanks Heather } if (Field("TeamSlide") == "Yes") { FusionPro.Composition.SetBodyPageUsage ("Team+Management", true); FusionPro.Composition.SetBodyPageUsage ("Team-Only", false); } if (Field("ComInsInclude") == "Yes") { FusionPro.Composition.SetBodyPageUsage("Divder-ComIns",true); FusionPro.Composition.SetBodyPageUsage("ComIns1",true); FusionPro.Composition.SetBodyPageUsage("ComIns2",true); FusionPro.Composition.SetBodyPageUsage("ComIns3",true); FusionPro.Composition.SetBodyPageUsage("ComIns4",true); FusionPro.Composition.SetBodyPageUsage("ComIns5",true); } if (Field("FleetInclude") == "Yes") { FusionPro.Composition.SetBodyPageUsage("ComIns-Fleet",true); } if (Field("CaptivesInclude") == "Yes") { FusionPro.Composition.SetBodyPageUsage("ComIns-Captives",true); } if (Field("EmpBenefitsInclude") == "Yes") { FusionPro.Composition.SetBodyPageUsage("Divider-EmpBen", true); FusionPro.Composition.SetBodyPageUsage("EmpBen1", true); FusionPro.Composition.SetBodyPageUsage("EmpBen2", true); FusionPro.Composition.SetBodyPageUsage("EmpBen3", true); FusionPro.Composition.SetBodyPageUsage("EmpBen4", true); FusionPro.Composition.SetBodyPageUsage("EmpBen5", true); FusionPro.Composition.SetBodyPageUsage("EmpBen6", true); FusionPro.Composition.SetBodyPageUsage("EmpBen7", true); FusionPro.Composition.SetBodyPageUsage("EmpBen8", true); FusionPro.Composition.SetBodyPageUsage("EmpBen9", true); FusionPro.Composition.SetBodyPageUsage("EmpBen10", true); } if (Field("TrendsInclude") == "Yes") { FusionPro.Composition.SetBodyPageUsage("EmpBenTrends1",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends2",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends3",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends4",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends5",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends6",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends7",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends8",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends9",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends10",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends11",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends12",true); FusionPro.Composition.SetBodyPageUsage("EmpBenTrends13",true); } if (Field("EducationInclude") == "Yes") { FusionPro.Composition.SetBodyPageUsage("Education1",true); FusionPro.Composition.SetBodyPageUsage("Education2",true); FusionPro.Composition.SetBodyPageUsage("Education3",true); } if (Field("COVIDInclude") == "Yes") { FusionPro.Composition.SetBodyPageUsage("COVID1",true); FusionPro.Composition.SetBodyPageUsage("COVID2",true); } if (Field("JFGInclude") == "Yes") { FusionPro.Composition.SetBodyPageUsage("Divider-JFG",true); FusionPro.Composition.SetBodyPageUsage("JFG1",true); FusionPro.Composition.SetBodyPageUsage("JFG3",true); FusionPro.Composition.SetBodyPageUsage("JFG4",true); FusionPro.Composition.SetBodyPageUsage("JFG5",true); FusionPro.Composition.SetBodyPageUsage("JFG6",true); FusionPro.Composition.SetBodyPageUsage("JFG7",true); FusionPro.Composition.SetBodyPageUsage("JFG8",true); FusionPro.Composition.SetBodyPageUsage("JFG9",true); FusionPro.Composition.SetBodyPageUsage("JFG10",true); } if (Field("PrioritiesInclude") == "Yes") { FusionPro.Composition.SetBodyPageUsage("Priorities",true); } if (Field("ExecSummaryInclude") == "Yes") { FusionPro.Composition.SetBodyPageUsage("Executive Summary",true); } }} Quote Link to comment Share on other sites More sharing options...
heather-grzybowski Posted February 27, 2023 Author Share Posted February 27, 2023 As an add on to this question - I've been testing further and when the field answers are anything but Yes the pages seem to show. Opposite from what I thought I was setting up. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted February 27, 2023 Share Posted February 27, 2023 It's hard to say what's going on without seeing the rest of the job. If you don't want to collect and post it, you could try some debugging statements, such as: Print('TrendsInclude="' + Field("TrendsInclude") + '"'); Print('ComInsInclude="' + Field("ComInsInclude") + '"'); // etc. And view the log (.msg) file to see the results. You might also consider setting the page usage in all cases, so that it doesn't matter whether the pages are set to Unused initially, something like this: var include = Field("TeamSlide") == "Yes"; FusionPro.Composition.SetBodyPageUsage ("Team+Management", include); FusionPro.Composition.SetBodyPageUsage ("Team-Only", !include); include = Field("ComInsInclude") == "Yes"; FusionPro.Composition.SetBodyPageUsage("Divder-ComIns", include); for (var i = 1; i <= 5; i++) FusionPro.Composition.SetBodyPageUsage("ComIns" + i, include); FusionPro.Composition.SetBodyPageUsage("ComIns-Fleet", Field("FleetInclude") == "Yes"); FusionPro.Composition.SetBodyPageUsage("ComIns-Captives", Field("CaptivesInclude") == "Yes"); include = Field("EmpBenefitsInclude") == "Yes"; FusionPro.Composition.SetBodyPageUsage("Divder-EmpBen", include); for (var i = 1; i <= 10; i++) FusionPro.Composition.SetBodyPageUsage("EmpBen" + i, include); include = Field("TrendsInclude") == "Yes"; for (var i = 1; i <= 13; i++) FusionPro.Composition.SetBodyPageUsage("EmpBenTrends" + i, include); include = Field("EducationInclude") == "Yes"; for (var i = 1; i <= 3; i++) FusionPro.Composition.SetBodyPageUsage("Education" + i, include); include = Field("COVIDInclude") == "Yes"; for (var i = 1; i <= 2; i++) FusionPro.Composition.SetBodyPageUsage("COVID" + i, include); include = Field("JFGInclude") == "Yes"; FusionPro.Composition.SetBodyPageUsage("Divider-JFG", include); for (var i = 1; i <= 10; i++) FusionPro.Composition.SetBodyPageUsage("JFG" + i, include); FusionPro.Composition.SetBodyPageUsage("Priorities", Field("PrioritiesInclude") == "Yes"); FusionPro.Composition.SetBodyPageUsage("Executive Summary", Field("ExecSummaryInclude") == "Yes"); Note the use of some "for" loops to reduce the repetitive code. Quote Link to comment Share on other sites More sharing options...
heather-grzybowski Posted February 28, 2023 Author Share Posted February 28, 2023 Thank you! I did quickly add the code you shared above, uploaded it and tested and didn't see any change. I've attached the files if you wouldn't mind taking a look. Let me know if I can provide any additional details. Thanks! EB_CL_Pitchbook_CCT-2023_Feb-28-2023_07-54-57.zip Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted March 1, 2023 Share Posted March 1, 2023 Thanks for posting the job files. I've said this many times, but the most important thing you can do to troubleshoot a FusionPro job is to look at the composition log (.msg) file, especially for any message which may be relevant to the problem you're trying to solve. Again, ALWAYS look carefully at the log file. When I compose your job, this is the tenth line in the log file: Quote uncaught exception: Error: In SetBodyPageUsage(), no page named "Divder-ComIns" This message also shows up in the Composition Status dialog. This is because of line 56 in the OnRecordStart rule: FusionPro.Composition.SetBodyPageUsage("Divder-ComIns", include); The name of the page here is misspelled; the actual page in the job is named "Divider-ComIns". The second "i" is missing in the page name in the rule. The FusionPro.Composition.SetBodyPageUsage function throws an exception when the page specified is not found. Unless the exception is caught with a try...catch block, the rest of the function, the rule in this case, is short-circuited, and the rest of the code after the exception is not run. This is the case here, where none of the rest of the code that tries to set the usage of any other pages gets run. If I fix that line so that the page name is correct, then I get another exception about another misspelling: Quote uncaught exception: Error: In SetBodyPageUsage(), no page named "Divder-EmpBen" When I fix line 64 of the rule as well, then I get this: Quote uncaught exception: Error: In SetBodyPageUsage(), no page named "JFG2" This is because we have this loop: for (var i = 1; i <= 10; i++) FusionPro.Composition.SetBodyPageUsage("JFG" + i, include); But while the job has a page "JFG1", and "JFG3", and 4, 5, 6, etc., there is no page "JFG2" present. Nor is there a "JFG8". If you really intend to have that whole series of "JFG" pages except for "JFG2" and "JFG8", then you can modify the logic in that loop to skip those two, like so: for (var i = 1; i <= 10; i++) { // skip "JFG2" and "JFG8" if (i !=2 && i != 8) FusionPro.Composition.SetBodyPageUsage("JFG" + i, include); } With all these changes, the job composes without throwing any exceptions saying that a page is not found. Anyway, you get the idea. You have to get this to run clean, with no exceptions, where all the calls to FusionPro.Composition.SetBodyPageUsage specify valid Body page names, and then it should work properly. Again, the log file is your friend. Quote Link to comment Share on other sites More sharing options...
heather-grzybowski Posted March 1, 2023 Author Share Posted March 1, 2023 UGH - thank you for the feedback. Spelling is usually my problem, and I totally didn't catch that this time. I appreciate the advice on the log file and will be sure to continually check that in the future. 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.