Range Size Cumulative Number
Let’s assume the price is different per interval, but stated per kg instead of per weight interval:
- The first kg cost 6,- € per kg
- The next 2 kg cost 1,50 € per kg
- The next 17 kg cost 2,- € per kg
The resulting range table would look like this (again the output data type has changed!).
Ranges Defined for a Single Number Output Property, Example 3
Weight Range | Package Price (Single Number Value) |
---|
]0;1] | 6 |
]1;3] | 1,5 |
]3;20] | 2 |
Again, both output property names must be set. Here the same names have been chosen as for the previous example. But remember, you could provide any name you want to the generated properties.
Aassume a value of 7 kg is passed to the table again, so that once again the third interval is hit. As both generated property names must be set, two output properties are calculated:
- For the property "Cumulative Price" all intervals are determined, that are prior to the interval hit by the number passed to the range table. As the number 7 means the third interval was hit, the first and second are selected.
- Not for each of these intervals the output column value is multiplied with the interval size. For the first interval this means .
- For the second interval this means
- Then the sum of these products is calculated:
- The property "Cumulative Price" will thus contain the value 9.
- For the property "Price" the value will again be the output vale of the interval hit by the number value passed to the range table. As the value is 7 the third interval is hit. Its output value is 2, so the value of the property "Price" is 2.
Looking at the results, you are not quite at the desired result yet. Our prices were supposed to work like this:
- The first kg cost 6,- € per kg
- The next 2 kg cost 1,50 € per kg
- The next 17 kg cost 2,- € per kg
Following this logic a package weight of 7 kg should result in
- 6,- € for the first kg
- 3,- € for the next 2 kg (each kg goes for 1,50 €)
- 8,- € for the remaining 4 kg (each kg goes for 2,- €).
This totals up to 17,- €.
The range table comparison came up with 9,- for the property "Cumulative Price" and 2,- for the property "Price". The sum of it is 11,- € so, you are clearly lacking 6,- €, as the last interval does not consider the quantity. So what is missing?
This is where the lower table labeled Computed Properties becomes important.
Each range table introducer creates a set of standard properties independent of the output columns your range table provides. These properties are there to provide flexibility to the user, so that a variety of price calculation models can be supported beyond the ones listed here. The following table provides a list of these properties along with an explanation of its meaning. You will need one of them.
List of Properties Along with an Explanation of its Meaning
Computed Value | Meaning |
---|
Lower Bound of Range | Contains the lower bound of the range, that was hit, if available. |
Upper Bound of Range | Contains the upper bound of the range, that was hit, if available. |
Range Size | Contains the size of a range. Usually this is calculated as <UPPER_BOUND_OF_RANGE> - <LOWER_BOUND_OF_RANGE>. |
Prorata in Range | Contains a factor varying between 0 and 1 indicating the relative position of the number value within the interval boundaries, where a value closer to 0 means the value lies more towards the lower bound and a value closer to 1 meaning the value lies more towards the upper bound. Example: A value of 17 compared with a range of ]10;20] would lead to a value of 0,7. It is calculated as (17-10):(20-10) or more generally as (<NUMBER_VALUE> - <LOWER_BOUND_OF_RANGE>) : (<UPPER_BOUND_OF_RANGE> - <LOWER_BOUND_OF_RANGE> |
Value Beyond Lower Bound | This is the distance of the number value from its lower bound. Example: A value of 17 compared with a range of ]10;20] would lead to a value of 7, as 17 – 10 is 7 or more generally <NUMBER_VALUE> - <LOWER_BOUND_OF_RANGE> |
Value Beyond Upper Bound | This property contains the distance of the number value and the upper bound of the last unbounded value. As a result this property can only be calculated for bounded range table classes. Example: A value of 27 compared with a last interval of ]10;20] would lead to a value of 7, as 27 – 20 = 7 or more generally <NUMBER_VALUE> - <UPPER_BOUND_OF_LAST_RANGE > |
For your purpose you need the computed property called Value Beyond Lower Bound. For the package weight of 7 kg the third interval is hit. Its lower bound is 3. The difference between 7 kg and 3 kg is 4 kg. These 4 kg must be multiplied with the output property value of the interval, which is 2,- €. The product of 2,- € and 4 kg totals up to the missing 8,- €
You can now total up the sums of all intervals:
- 6,- € for the first kg
- 3,- € for the next 2 kg (each kg goes for 1,50 €)
- 8,- € for the remaining 4 kg (as you have just calculated)
The sum is 17,- €, as expected.
You can use the computed properties as you see fit. However, not all the properties are available in each branch. The following table shows for which branches each property is available.
Branches and Properties
| | <property> is below the first bound | <property> is in a range | <property> Found in last Unbounded Range | <property> Is Above the Last Defined Bound |
---|
| Lower bound of range | It is equal to 0 | It is equal to the lower bound of the selected range. | It is equal to the lower bound of the selected range. | It is equal to the last upper bound. |
Computed Property | Upper bound of range | It is equal to 0 | It is equal to the upper bound of the selected range. |  | It is equal to the last upper bound. |
Range Size | It is equal to 0 | Upper Bound of Range - Lower Bound of Range. |  | It is equal to the last upper bound. |
| Prorata in Range |  | Value Beyond Lower Bound / Range Size |  |  |
| Value Beyond Lower Bound |  | Difference between the lower bound of the range and the value of the input property that is used to select the appropriate range | Difference between the lower bound of the range and the value of the input property that is used to select the appropriate range |  |
| Value Beyond Upper Bound |  |  |  | Difference between the upper bound of the last defined range and the value of the input property |