Sorting MultiValued Items

The BY-EXP and BY-EXP-DSND modifiers sort the data in MultiValued attributes, and make it possible to produce sorted reports from files whose items contain more than one value per attribute.

For example, the items in the ORDERS file contain the following MultiValued attributes, because one order may include more than one title:

TITLE

NUMBER

SHORT-TITLE

PRICE

CODE

AMOUNT

The BY-EXP and BY-EXP-DSND modifiers ensure that all data from an order item is included in a report.

The query below produces a report that sorts items by short title and includes data from four MultiValued attributes.

>SORT ORDERS BY-EXP SHORT.TITLE BREAK-ON SHORT.TITLE BOOKCODE QTY AMOUNT

 

 

 

 

PAGE   1

 

10:58:01  DD MMM YYYY

 

 

 

 

ORDERS Short Title

Book Code

Qty

Subtotal

 

 

 

 

10101 DATABASE

N01

2

$19.90

10102 DATABASE

N01

1

$9.95

10103 DATABASE

N01

2

$19.90

10104 DATABASE

N01

3

$29.85

10105 DATABASE

N01

1

$9.95

10107 DATABASE

N01

9

$89.55

10110 DATABASE

N01

12

$119.40

10114 DATABASE

N01

5

$49.75

10115 DATABASE

N01

1

$9.95

10118 DATABASE

N01

3

$29.85

 

 

 

 

***

 

 

 

 

 

 

 

10102 OPERATING

N02

3

$56.25

10104 OPERATING

N02

5

$93.75

10106 OPERATING

N02

3

$56.25

10107 OPERATING

N02

34

$637.50

10108 OPERATING

N02

10

$187.50

10110 OPERATING

N02

3

$56.25

The preceding report breaks after each short title, which appears in the report as a separate item. Notice, for example, that there are two separate entries for order item 10110. This means that the customer ordered at least two different books.

See Also

Using SORT Expressions

Sorting By Multiple Attributes