- Overview
- Creating the Iteration block
- Printing an Iteration block
- Replace 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.
New in version 28Remark: By Default, the iteration blocks are displayed according to the order of creation of the blocks. It is possible to change this order in the editor. For more details, see Handling the report blocks. Printing an Iteration block An Iteration block is used to: - replace an existing block.
- add an additional block to the report.
Replace 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:
// --Après impression de HautPage // Substitution du bloc HautPage par le bloc // Itération sur la prochaine page de mon état iSubstBlock(HautPage, Itération)
- 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:
// --Après impression de Itération // Annulation de la substitution du bloc HautPage // par le bloc Itération sur la prochaine page de mon état iSubstBlock(HautPage, "")
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:
// --Après impression du Fin de rupture // Est-ce que le produit en cours d'impression est en promotion? IF MySource.Promotion = True THEN // Impression du bloc Itération iPrintBlock("Itération") END
This page is also available for…
|
|
|
|