Background
There are times you are interested in summing up the results across various dimensions with specified conditions or indicators to exclude some results from the ARRAY_SUM
function.
There is an incident that I need to separate medical health UCOI cash flows from total medical UCOI cash flows, because there are different loss ratios for these two types of UCOI cash flows, and separating medical UCOI cash flows into two distinct cash flows help me prepare for the calculation.
Steps of Development
Specify dimension size for the array
Here we create a dimension called EV_UCOI_B
in the Workspace Objects. The resulting dimension has a size of 5, and we intend to store medical only cash flows at dimension 1 and medical health cash flows at dimension 5.
For EV_UCOI_RES
, we have 4 dimensions, and we would like to create a new dimension (5) to separate medical health cash flows from medical cash flows (1).
Step 1 | Step 2 |
Make the dimension be assessable to Prophet
The dimension size needs to be obtained so that we can refer to it in the extended formula.
Step 3 |
Step 4 |
Create the extended formula
The dimension size needs to be obtained so that we can refer to it in the extended formula.
Step 5 |
Now we create an array called CF_ARRAY
with a size of (5, 7)
, given EV_MODEL_DIM_SIZE = 7
.
LS_MY_EV_POL_RES_UDR_UCOI_CF
is also with a size of (5, 7)
.
n
is the indicator of UCOI CF type, with a constrain from 1 to 5, determined based on the dimension of LS_MY_EV_POL_RES_UDR_UCOI_CF
and the resigned indicator of LS_MY_EV_POL_RES_UDR_UCOI_TYPE
.
If n
is non-zero (zero is assigned for not applicable situations), LS_MY_EV_POL_RES_UDR_UCOI_CF(j, i)
will be allocated to CF_ARRAY(n, i)
.
Step 6 |
Extract variables from the extended formula
Usually we are interested in examining the information stored in an array variable defined in the extended formula. In this case, we need an intermediate variable to extract the information from the extended formula.
This is an array dimension, with dimensions to be aligned with the array CF_ARRAY
in LS_MY_EV_POL_RES_UCOI_B_GRP_CF
.
Step 7 |
We extract CF_ARRAY
from the extended formula:
Step 8 |
The output as we expected, no results can be viewed for the array variable in the extended formula:
But we can view the extracted results from our intermediate variable: