Number Splitter
The most prominent splitter component is probably the number splitter. Its purpose is to split a numeric value into two parts at a given threshold.
Let’s look at an example:
Assume your customer used your service for a certain number of units. The subscriber of the service was given certain amount of free service usage units, that you need to settle against the usage reported by the metering system before you can determine how much to charge.
SERVICE_USAGE: X Units
FREE_USAGE: Y units
As your price calculation logic cannot tell whether the customer service usage is below or above the amount of free usage still available to the customer, it must make a comparison first. Depending on the result the correct arithmetic calculation needs to be made, so that the result can be processed properly. This calculation can be:
- SERVICE_USAGE – FREE_USAGE if the free service usage volume still available is smaller than the consumed service quantity. The result can be charged for, and the free service usage balance will be set to 0.
- FREE_USAGE – SERVICE_USAGE if the free service volume still available is larger than the consumed service quantity. The result will be deducted from the free usage balance and nothing will be charged.
This is rather complicated, and the splitter can help to simplify this calculation. In the configuration you will select a numeric "Property Name" containing the number to split in two parts. As the "Split Value" another numeric property needs to be selected, that contains the threshold at which to split the first property. Note, that you can also enter a static number here, but as this is rather static this is usually not done.
The component expects you to provide the names of the numeric properties it will write the result of the split operation to. The first property will be given the value of "Property Name" up to the "Split Value", while the second will be assigned any value of "Property Name" beyond the "Split Value".
Let’s see how the component would be configured for the example given above.
The property to split here is "SERVICE_USAGE". As the split value the counter "FREE_USAGE" has been provided. The result of the split is written into the properties "USAGE_FREE_OF_CHARGE" and "USAGE_TO_CHARGE" respectively.
Let’s be specific and assume the customer consumed 7 units, while the balance of FREE_USAGE is 5 units. From the 7 units used 5 units are below the threshold of 5 units still free. Therefore, the property USAGE_FREE_OF_CHARGE is given the value "5".
From the 7 units used 2 units are above 5 units still free. Therefore, the property USAGE_TO_CHARGE is given the value "2".
The component creates two outbound branches, which are both executed:
Note that the property "USAGE_FREE_OF_CHARGE" is only available in the outbound branch labeled "SERVICE_USAGE: Up to FREE_USAGE" while the property USAGE_TO_CHARGE is only available in the branch labeled "SERVICE_USAGE: Beyond FREE_USAGE". As you can see the remaining logic you need to implement is a lot simpler this way, as some of the arithmetic calculations have been made by the splitter component for you.
Note
Depending on the data provided as inputs to the component, the USAGE_FREE_OF_CHARGE as well as the USAGE_TO_CHARGE output properties can be zero.