Example
Overview
Product List by Rule builds the product list of a document from XML rules instead of a custom CScript build script. The configuration describes how products are collected, filtered, sorted, and which templates, page templates are assigned. The plugin reads that configuration and returns the finished product list for rendering.
This example renders a document with two planned products. In the planning no templates are assigned. After processing the products get the same template, assigned by a single rule with no filtering. It is the smallest configuration that produces a finished document, and a good starting point before you add conditions, page breaks, or several rules.
It does not show the reason why Product List by Rule exists. Project data often represents deeply nested trees, and the user might want to plan at the chapter level. The build-up script helps traverse all the children below the selected level and assigns chapter overviews, product templates, optional accessory templates, and more, all by rules.
Before you start, make sure the plugin is deployed, and that a page template and a product template exist in your project. See Installation and Configuration.
The default configuration works best with the consistent demo data and demo templates. If you are using different page templates or product templates please ensure you replace them with your specific identifiers or template names.
Prepare Document
Your starting point should be the priint:planner application.
- Create a new dynamic document with these parameters:
- Language (identifier:
_language):eng - Country (identifier:
_country):US - Rendering Rule Set (identifier:
_renderingruleset):Generic
- Language (identifier:

The context parameters of the document. They pass the document context to the plugin and the placeholders.

The Rendering Rule Set parameter selects the rule set. Its value must match the configId of a rule set in the XML
configuration. This example uses Generic in both places.
- Plan two products in the document:

Two planned products. The Entity Identifier is product, which is the value you would use in <entityIdentifier> if
you filter products by entity. The Product Template column is empty, so no template is planned on either record.
The rule below assigns the template instead.
Create a Basic XML Configuration
Define a new rule set inside the XML configuration file productListRule.xml.
The configuration file in the plugin folder
com.priint.accpack.productlistbyrule.GenericProductListByRulePlugin/WerkII/default/productListRule.xml.
<productListRuleSet configId="Generic" log="0" logPath="$DESKTOP/product-list-rule.log" mode="planning">
<productListRules defaultPageTemplate="268494491" exclusive="true">
<pageTemplate>
<documentParameter identifier="_priint_pageTemplate"/>
</pageTemplate>
<!-- If assign templates -->
<productListRule sort="1">
<conditionList operator="or">
<condition sort="1">
<planning>
<rootTemplate>PLANNED_TEMPLATE</rootTemplate>
</planning>
</condition>
</conditionList>
<actionList>
<action method="addCurrentBucket">
<pageItemIds>
<when assignTemplate="PLANNED_TEMPLATE"/>
</pageItemIds>
</action>
</actionList>
</productListRule>
<!-- If do not assign templates -->
<productListRule sort="2">
<actionList>
<action method="addCurrentBucket">
<pageItemIds>
<when assignTemplate="268495292"/>
</pageItemIds>
</action>
</actionList>
</productListRule>
</productListRules>
</productListRuleSet>
Understand the Configuration
The next tables explain the example configuration. Check the Reference for an in-depth explanation of all configuration options.
Rule Set
The first element sets the name, the mode, and the logging of the rule set.
| Attribute | Value | Meaning |
|---|---|---|
configId | Generic | The name of the rule set. It must match the document's _renderingruleset parameter so that the plugin can find the rule set. The default is Generic. |
mode | planning | Retrieves products through planning records. Works for buckets and planning records. |
log | 0 | No log file is written. Set it to 1 while you test your configuration to write the incoming and returned product lists to the log file. |
logPath | $DESKTOP/product-list-rule.log | The location of the log file. |
Rules Container
This element holds the rules and the page template settings.
| Element or attribute | Value | Meaning |
|---|---|---|
defaultPageTemplate | 268494491 | The ID of the default page template which acts as fallback. |
pageTemplate | _priint_pageTemplate | Gets the page template from this document parameter. |
exclusive | true | Only the first matching rule is applied to each product. The rules are evaluated in sort order. |
Rules
This example has two rules. Due to the exclusive configuration, the second rule will act as a fallback. If the template is not assigned during the planning, use a fallback template.
| Rule | Condition | Action | Result |
|---|---|---|---|
Rule 1 (sort="1") | The planning condition checks for PLANNED_TEMPLATE. | addCurrentBucket with assignTemplate="PLANNED_TEMPLATE" | The product uses the template that is planned on its record. |
Rule 2 (sort="2") | None. It applies to all products that Rule 1 does not handle. | addCurrentBucket with assignTemplate="268495292" | The product uses template 268495292. |
The assignTemplate attribute sets the template. Use a template ID to set one template for all matching products. Use PLANNED_TEMPLATE to use the template that is already planned on the record. The products in this example have no planned template, so Rule 2 sets the template for both of them.
Replace the example IDs 268494491 (Page template) and 268495292 (Product template) with the template IDs in your project. Keep PLANNED_TEMPLATE as the keyword for the dynamic template assigned in planning.
Find the Template IDs
Copy the IDs from priint:planner.
Copy the page template identifier from the Page Templates panel. Here BNH_Product Page demo page template has the ID 268494491.
Copy the template identifier from the Templates panel. Here BNH_Beginner_Product demo template has the ID 268489866.

The BNH_Beginner_Product template with its placeholders.
This example uses numeric identifiers so that they match the panels in the screenshots. Identifiers are generated per system, so a configuration with numeric identifiers might not work on another system if the template is created manually on each. In a project configuration, use the page template name and the template name instead.
Render Document
Run the build script to render the document.

Start the process Run Renderer Script and select the build script Rendering Layout By Rule.
Select the option Recreate Document to ensure that the new rendering is not appended to the existing document.
Rendering Layout By Rulescript is used to render the document with product list defined in the XML configuration. It's shipped with the plugin and gets added during installation.
The build script in Management Planner, under Document Planning.
Document Result
After the build script runs without errors, the document is rendered with 2 products within page template, template defined in the XML configuration.

Both planned products rendered with the BNH_Beginner_Product template on the BNH_Product Page page template.