How to Implement a Dynamic Page Break Using an Optional Filter
Page Breaking is a useful feature to offer report consumers. However, it’s often difficult to do this if the item you want to break on is dynamic. Here we show you how to do this with cascading, optional prompts while page breaking on the lowest level chosen.
Step by Step Instructions:
1. To get started, let’s create a simple list report with the following fields:
2. Create a prompt page with product line, product type and product as optional cascading value prompts; name each prompt object with name “pLine”, “pType” and “pProduct” respectively.
You will have the Product Type prompt cascaded by Product Line, and the Product prompt cascaded by Product Type.
Hint: to name each prompt object click on the object then on the right properties panel under Miscellaneous ->Name
3. Add optional filters “ pLine, pType, pProduct” to the report query:
4. Test the report to make sure it is working correctly at this point
6. Delete “Finish” button on prompt page. Drag a new HTML item and create a new custom “Finish” button using the following HTML code:
<button type=”button” name=”finish99″ id=”finish99″ onclick=”assignParamValue()” style=””
class=”bp” onmouseover=”” onmouseout=”” onkeypress=”return preventSubmitEvent(event);”>
if( f.elements[“_oLstChoicespLine”].selectedIndex>=0 )
f.elements[“_textEditBoxpLevel”].value = tmp;
//uncomment for debugging
//alert (‘Page set breaks by ‘+document.forms[“formWarpRequest”].elements[“_textEditBoxpLevel”].value);
promptButtonFinish(); //submit request
8. Now add a new data item to report query, name it as “pagebreak by”. Use the following expression:
if (?pLevel? =’pProduct’)
else if (?pLevel?=’pType’)
else if (?pLevel?=’pLine’)
9. Set up page breaking for the report and group it by the “pagebreak by “ data item you just created:
10. Click on Page1, then on Properties Panel click on “Master Detail Relationships”. Define the master detail relationship from “pagebreakby” to “pagebreakby”.
11. Go back to report page. Drag “pagebreak by” data item to report title area:
12. Run the report. If you select two product types then the report should return two pages. The report title should also dynamically change base on page break:
Sample Report Page 1:
Sample Report Page 2: