|
|
|
|
|
- Overview
- Creating the Iteration block
- Printing an Iteration block
- Replacing an existing block
- Adding an additional block to the report
Iteration block (or substitution block)
The Iteration block is a free block, created manually in the report editor. It can be used like any other type of block. For example, an Iteration block can be used to replace a Page header block in order to differentiate between the even pages and the odd pages. The block substitution is performed through programming with iSubstBlock. You also have the ability to print a specific block with iPrintBlock. Remark: The planes are available in the reports from version 19. In most cases, using planes in the reports allows you to replace the iteration blocks. Using planes in the reports is easier than using iteration blocks. For more details, see The planes. Creating the Iteration block To create an Iteration block: - Perform one of the following operations in the report editor:
- on the "Creation" tab, in the "Structure" group, expand "Blocks".
- select "Add a block" from the popup menu of the report (right mouse click on the report currently created).
- click the "Add a block" button in the "Blocks" tab of the report description.
- Select the "Iteration block" type.
Remark: By default, iteration blocks are displayed in the order in which they were created. You can change this order in the editor. For more details, see Handling report blocks. Printing an Iteration block An Iteration block is used to: - replace an existing block.
- add an additional block to the report.
Replacing an existing block The programming required to replace an existing block is illustrated by the following example:
| | | | Example | The page header of my report must differ for the even pages and for the odd pages. The Page header block corresponds to the odd pages (it will be printed on page 1, 3, 5 ...). Therefore, this block will be printed on the first page of my report. The Iteration block corresponds to the even pages. |
- Add (if necessary) a Page header block: on the "Creation" tab, in the "Structure" group, expand "Blocks" and select "Page header". This block is named "PageHeader".
- Customize the "PageHeader" block like the one corresponding to the odd pages.
- Write the following code In the "After printing" of the block "PageHeader" event:
// --After printing the PageHeader // Substitute the PageHeader block by the // Iteration block on the next page of my report iSubstBlock(PageHeader, Iteration) - Add (if necessary) an Iteration block: on the "Creation" tab, in the "Structure" group, expand "Blocks" and select "Iteration block". This block is named "Iteration".
- Customize the "Iteration" block like the one corresponding to the even pages.
- Write the following code in the "After printing" of the block "Iteration" event:
// --After printing the Iteration // Cancel the substitution of the PageHeader block // by the Iteration block on next page of my report iSubstBlock(PageHeader, "") Remark: To substitute a Page footer block, we recommend that you use blocks of same height to avoid any print problems. Adding an additional block to the report The programming required to add an Iteration block is presented in the following example:
| | | | Example | The "RPT_ProductReport" report prints the description of each product (a break is performed on "ProductNum"). A promotion is available for some products. In this case, the item "Promotion" in the data file "Product" corresponds to True. This item is a boolean. For the products in promotion, the "Iteration" block is added to the report. This block describes the type of offer applicable to the product (buy two for the price of one, 20% off, ...). |
- Add if necessary an "Iteration" block: on the "Creation" tab, in the "Structure" group, expand "Blocks" and select "Iteration block". This block is named "Iteration".
- Customize the "Iteration" block.
- Write the following code In the "After printing" of the block "End of break" event:
// --After printing the End of break // Is the product currently printed in promotion? IF MySource.Promotion = True THEN // Print the Iteration block iPrintBlock("Iteration") END
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|