An Example of Block Iterator Usage

Parsing of Trade Parts table with Multiline Descriptions - An Example of Block Iterator Usage.

Example Description

This example shows how to use Block Iterator component, which allows to parse data block by block and to execute a set of processing components for every parsed block.

To load the example, import the rules list rules.txt from Examples\BlockIterator folder.

The example is solution of the task of parsing data from orders, which are represented in tables by multiple rows. Upon receiving of a message, a table block is parsed from it. Using Block Iterator multiline parts descriptions are parsed from the block for parts of one kind. These blocks are split to rows using Line Iterator Component. Using Regular Expression Parser description field's values are parsed from rows. The values are stored into a text file in user format.

Example Rule Description

Filtering

There is the Subject Filter that filters all messages except debug messages from the example.

Processing

Parsing of parts table to the PartsData variable.

Iterating through PartsData, parsing every block to the PartBlock variable and executing for it next operations:

Iterating through PartBlock, parsing every line to the Part variable and executing for it next operations:

Skipping iteration if Part contains found mark.

Parsing of part fields from Part to PartName, PartCount variables.

Storing of the data parsed into the text file.

Debug Messages

There is one debug message used to show how the rule works.

© 2020 Mediatwins s.r.o. All rights reserved.