Lines With Dependencies

In the previous example, there were no dependencies between the lines in the input file but usually, there are.

The following listing shows the example of a file with order headers and assigned order positions. The order header is in a separate line, followed by the associated order positions. The file contains three jobs with one, two and three positions.

#OrderHeader=OH
#OrderPosition=OP
OH;Order1
OP;Pos1 O1
OH;Order2
OP;Pos1 O2
OP;Pos2 O2
OH;Order3
OP;Pos1 O3
OP;Pos2 O3
OP;Pos3 O3

Such a hierarchical dependency can be mapped with Lobster_data in two different ways.

The first screenshot shows the source structure for the example file. The order header node and the position node were inserted at the top level.

images/download/attachments/21304228/CSV_7-version-3-modificationdate-1527643712000-api-v2.png

The second screenshot shows an alternative source structure for the example file. The order header node and the position node were placed in a parent node Order.

images/download/attachments/21304228/CSV_8-version-3-modificationdate-1527643699000-api-v2.png

The difference between the two solutions is that for the source structure in the first screenshot, a new record is created for each order header, while the source structure in the second screenshot only creates a single record that contains all orders.

If there are no dependencies between the orders that have to be taken care of, the first solution is to be preferred. The reason is that the parser works within a record. The smaller the amount of data in a record, the faster the parser will work, although this only matters with large amounts of data.

If dependencies between the orders are to be established in the output data (for example, combining the orders in one shipment), the second solution has to be chosen. In this solution, the three orders are held in the same record, which allows you to handle the dependencies (see more in the section Phase 3/4 (GUI)).

Whenever the first top-level node in the source structure (in the case of a CSV parser) is entered and there are multiple top-level nodes, the parser begins a new record. In the first example, a new record is therefore created for each order header. This creates a record for each order, containing the order header and all related positions.

The order of the fields in the nodes determines which values of the data rows are assigned to the fields in the source tree.