Returns a subset from a set, in which the subset is a numerically specified range of tuples.
Syntax
Subset ( set, index1 [,index2 ] )
Parameter | Description |
---|---|
The set from which to take tuples. | |
index1 | The location of the tuple with which to begin the subset. Example: if index1 is 0, the subset begins with the first tuple of set. If a negative value, the return is an empty set. |
index2 | Optional. The count of tuples to include in the subset. If omitted, all tuples to the end of set are returned. If a negative value, the return is an empty set. If the count goes beyond the range of the input set, all tuples to the end of the set are returned. |
Notes
The first tuple of the subset is represented by index1. If index1 is 0, then the first tuple of the returned subset will be the same as the first tuple of the input set.
Example
The following expression
Subset ({Product.Members},0)
returns the set:
{ Product, [100-10], [100-20], [100-30], [100], [200-10], [200-20], [200-30], [200-40], [200], [300-10], [300-20], [300-30], [300], [400-10], [400-20], [400-30], [400], [100-20], [200-20], [300-30], Diet }
All tuples of the set {Product.Members} are returned, because the subset is told to begin with the first tuple, and no count of tuples given for index2.
The following expression
Subset ({Product.Members},0,4)
returns the set:
{ Product, [100], [100-10], [100-20] }
Therefore, the following query
Select Subset ({Product.Members},0,4) on columns from sample.basic
returns the grid:
Product | 100 | 100-10 | 100-20 |
---|---|---|---|
105522 | 30468 | 22777 | 5708 |