> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Drill-in configuration

export const productName = "Atoti FRTB";

The drill-in functionality is partially handled on the server side since
the 1.2.0 release of {productName}. It can be configured using the corresponding
configuration file: *drillInConfig.json,* located in
the *frtb-application/src/main/resources* directory. This section contains
an explanation of the structure of the new configuration file and
provides a detailed example.

## Client Side

The available drill-in actions in the UI are based on the *column key* of the selected cell *string matching*. It is important to
make sure that a specific action only appears on supported measures.
For example, when drilling down to Risk Position from a Risk Charge measure,
the Pro-Rata, Euler and Incremental measures are filtered out, as the
action is not supported for these.

Sequence:

1. After an action is selected, the column key gets passed to the server side. In these cases, where there is more than one drill-in action available for a specific cell, an
   additional *drillInType* parameter gets passed to the server side, specifying which action has been selected.
2. The drill-in service passes back the hierarchies to be used on the rows and the measure to drill down to.
3. The MDX is then generated on the client side.

Available drill-in actions are configured in the **FRTBSettings.ts** file in */src/configurations*. The key
for this configuration is `drillinPluginMap` which is an array of available actions with the following properties:

| Key                 | Type              | Description                                                                                                                                                                                                                                 |
| ------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **name**            | *string*          | Name for the action in context-menu                                                                                                                                                                                                         |
| **type**            | *string*          | Type of drill-in                                                                                                                                                                                                                            |
| **isRiskClass**     | *boolean or null* | Check if the table has to have risk class                                                                                                                                                                                                   |
| **checkDoubleSums** | *boolean*         | Specifies if the measure has double sums                                                                                                                                                                                                    |
| **measures**        | *object*          | Has two conditions<br />\_ **true**: at least one of the strings from each array has to be included in the selected measure string<br />\_ **false**: if the measure contains the string from the array, the drill-in will not be available |

## Server Side

The aforementioned configuration file: *drillInConfig.json* consists of
an array of json objects. A particular entry will have the following
pattern:

<Frame>
  <img src="https://mintcdn.com/activeviam/Odsmni_6IdWKYJb8/solutions/frtb/6.0/images/drill-in/drillIn_config_entry.PNG?fit=max&auto=format&n=Odsmni_6IdWKYJb8&q=85&s=ef6f71efc8e7826f0e5db7187ea04c60" alt="drill-in entry in the config.json file" width="977" height="139" data-path="solutions/frtb/6.0/images/drill-in/drillIn_config_entry.PNG" />
</Frame>

After extracting the measure name from the column key passed in from the
UI, an entry is selected based on pattern matching. Let's assume that
the measure passed in is <u>[GIRR Delta Risk Position High](../../cube/girr-delta-risk-position)</u> and
the additional drillInType parameter set to *QIS*, so that the above
entry is selected.

<Note>
  If a drillInType parameter is not passed in, the drillInType part of the json entry is ignored.
</Note>

#### Constructing the drill-in measure(s)

A common pattern in the drill-in measures is that, in order to construct
the measure name, only a small part of the input measure name string
needs to be updated. By using captured name groups, it is possible to
extract specific parts of the match and update them. In the above
example:

| Named capture group           | Matched string       | To be replaced by            |
| ----------------------------- | -------------------- | ---------------------------- |
| *\<drillInParamDoubleSums>*   | *Risk Position High* | *Risk Position Double Sums*  |
| *\<drillInParamCorrelations>* | *Risk Position*      | *Risk Position Correlations* |

Hence, the two measures in the drill-in
are: [](../../cube/girr-delta-risk-position-double-sums)[<u>GIRR Delta Risk Position</u>](../../cube/girr-delta-risk-position-double-sums)[](../../cube/girr-delta-risk-position-double-sums), [<u>Sums</u>](../../cube/girr-delta-risk-position-double-sums) and [<u>GIRR Delta Risk Position Correlations High</u>](../../cube/girr-delta-risk-position-correlations).

#### Constructing the hierarchies used on the rows

In the case of the hierarchies on the rows, the risk class often appears
in the name of the hierarchy. Therefore, taking advantage of the named
capture groups again, wherever the string *\{riskClass}* appears, it will
be replaced by the string matched by the capture
group *\<riskClass>*. In the above example,
the *\<riskClass>* capture group matches the string GIRR.

Hence, after the string
manipulations, the hierarchies on the rows
are: [\[Buckets\].\[GIRRBuckets\].\[GIRR Bucket\]](../../cube/girr-buckets), [\[Double
Sums\].\[GIRR Delta Double Sums\].\[Curve\]](../../cube/girr-delta-double-sums).

#### Example without named capture groups

Named capture groups make it possible to group similar use
cases (e.g. similar type of action for different risk classes). However,
you can specify the drill-in functionality without using named capture
groups.

<Frame>
  <img src="https://mintcdn.com/activeviam/Odsmni_6IdWKYJb8/solutions/frtb/6.0/images/drill-in/drillIn_config_entry_no_param.PNG?fit=max&auto=format&n=Odsmni_6IdWKYJb8&q=85&s=ab057ef9781e353026b347915814204c" alt="example without named capture groups" width="454" height="96" data-path="solutions/frtb/6.0/images/drill-in/drillIn_config_entry_no_param.PNG" />
</Frame>

The above entry will only match the
measure [*IMCC.D2D*](../../cube/imcc-d2d) and
passes the
measures *[\[IMCC\]](../../cube/imcc-ima), and
[*IMCC.D2D*](../../cube/imcc-d2d)* together
with the hierarchy [Risk Classes](../../cube/risk-classes) back to the UI without modifications.
