Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Function Declaration
-
Function Partition(Number As Variant, Start As Variant, Stop As Variant, Interval As Variant) As Variant
|
Parameter |
Description |
|---|---|
|
Number |
Long to be evaluated against the ranges. |
|
Start |
Long that is the start of the overall range of numbers. The number can't be less than 0. |
|
Stop |
Long that is the end of the overall range of numbers. The number can't be equal to or less than Start. |
|
Interval |
Long that is the interval of each range. The number can’t be less than 1. |
Runtime Semantics.
§ Returns a String indicating where a number occurs within a calculated series of ranges.
§ The Partition function identifies the particular range in which Number falls and returns a String describing that range. The Partition function is most useful in queries. You can create a select query that shows how many orders fall within various ranges, for example, order values from 1 to 1000, 1001 to 2000, and so on.
§ The following table shows how the ranges are determined using three sets of Start, Stop, and Interval parts. The First Range and Last Range columns show what Partition returns. The ranges are represented by lowervalue:uppervalue, where the low end (lowervalue) of the range is separated from the high end (uppervalue) of the range with a colon (:).
|
Start |
|
Interval |
Before First |
First Range |
Last Range |
After Last |
|---|---|---|---|---|---|---|
|
0 |
|
5 |
" :-1" |
" 0: 4" |
" 95: 99" |
" 100: " |
|
20 |
|
10 |
" : 19" |
" 20: 29" |
" 190: 199" |
" 200: " |
|
100 |
|
20 |
" : 99" |
" 100: 119" |
" 1000: 1010" |
" 1011: " |
§ In the preceding table, the third line shows the result when Start and Stop define a set of numbers that can't be evenly divided by Interval. The last range extends to Stop (11 numbers) even though Interval is 20.
§ If necessary, Partition returns a range with enough leading spaces so that there are the same number of characters to the left and right of the colon as there are characters in Stop, plus one. This ensures that if you use Partition with other numbers, the resulting text will be handled properly during any subsequent sort operation.
§ If Interval is 1, the range is number:number, regardless of the Start and Stop arguments. For example, if Interval is 1, Number is 100 and Stop is 1000, Partition returns " 100: 100".
§ If any of the parts is Null, Partition returns the data value Null.