Skip to main content
Skip table of contents

Complex Sort

Overview

The Complex Sort tool consumes and produces a single complex record stream. It orders the records according to the __ID, __ParentID, and __Sequence values. The __ID values must be unique. The numeric values of __ID and __ParentID are unimportant and do not influence the order. No other fields are considered by the sort, but the __Type, __Name, and __Variant fields must be present.

The following algorithm is used to sort the records:

  • All records with __ParentID=0 are considered to be "root" records. They are ordered by __Sequence and form the first level of the output.

  • Repeat until a pass extracts no records:

    • Extract child records whose __ParentID fields match the __ID values of the previous level of parent records.

    • Place the new child records directly after their parent records in the output, ordered by __Sequence.

  • All remaining records are unmatched and are sent to the error output.

The order in which children are defined in the nesting section of the complex schema is not taken into consideration. If you want some child records to appear before others, you must ensure that the __Sequence values of the child records are set to reflect the intended order.

Example

If the following records are input into Complex Sort:

__ID

__ParentID

__Sequence

6

5

1

8

5

3

13

8

1

5

0

1

15

8

3

3

0

2

14

8

5

2

3

1

the output order will be:

__ID

__ParentID

__Sequence

5

0

1

6

5

1

8

5

3

3

0

2

2

3

1

13

8

1

15

8

3

14

8

5

Complex Sort tool configuration parameters

The Complex Sort tool has one set of configuration parameters in addition to the standard execution options:

Configuration

Parameter

Definition

Override schema

If selected, overrides the schema contained in the file records.

Schema

If Override output file is enabled, specifies the complex schema definition file.

Configure the Complex Sort

To configure the Complex Sort tool:

  1. Select the Complex Sort tool, and then go to the Configuration tab.

  2. Optionally, select Override schema and specify a complex schema definition file as Schema.

  3. Optionally, go to the Execution tab, and then set Web service options.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.