> ## 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.

# Day-To-Day Table Context Menu

## Overview

| Plugin key                                | BAS Setting key                 |
| ----------------------------------------- | ------------------------------- |
| `accelerator_plugin-menu-pivot-table-d2d` | `bas-plugin-menu-item-daytoday` |

This context menu action plugin allows you to select the header of a single measure in a table and calculate the Day-To-Day difference for it. It will generate a new measure in the same table displaying the result.

<Frame>
  <img src="https://mintcdn.com/activeviam/YviEhKHiQzio8y61/solutions/libraries/ui-components/5.2.22/images/accelerator_plugin-menu-pivot-table-d2d_1.png?fit=max&auto=format&n=YviEhKHiQzio8y61&q=85&s=ae8d25925be28f37835d63c11eeaada0" alt="Pivot Table D2D - 1" width="293" height="253" data-path="solutions/libraries/ui-components/5.2.22/images/accelerator_plugin-menu-pivot-table-d2d_1.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/activeviam/YviEhKHiQzio8y61/solutions/libraries/ui-components/5.2.22/images/accelerator_plugin-menu-pivot-table-d2d_2.png?fit=max&auto=format&n=YviEhKHiQzio8y61&q=85&s=93244a27469c5d1958bd2c02026ad8af" alt="Pivot Table D2D - 2" width="284" height="117" data-path="solutions/libraries/ui-components/5.2.22/images/accelerator_plugin-menu-pivot-table-d2d_2.png" />
</Frame>

## Availability

| Solution    | Enabled |
| ----------- | ------- |
| FRTB        | ✅       |
| Market risk | ✅       |
| SIMM        | ✅       |
| CVARC       | ✅       |
| Limits      | ❌       |
| Sign-off    | ❌       |

## Settings

| Key                     | Type     | Description                                       | Example |
| ----------------------- | -------- | ------------------------------------------------- | ------- |
| `asOfDateDimensionName` | `string` | The name of the dimension holding the as-of dates |         |
| `asOfDateHierarchyName` | `string` | The name of the hierarchy holding the as-of dates |         |

## How to modify a setting

To modify a setting, you need to modify the `basSettings` that you provide to the `activate` function. The following example shows you how to provide the activate function with the default `basSettings` while updating the settings for the Day-To-Day context menu action:

```javascript theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
import { activate, basSettings } from "@activeviam/frtb-sdk";

const frtbServerKey = "FRTB";
const customSettings = structuredClone(basSettings);

customSettings[frtbServerKey][
  "bas-plugin-menu-item-daytoday"
].asOfDateDimensionName = "Custom_AsOfDate_Dim_Name";

activate({
  configuration,
  basSettings: customSettings,
});
```

## How to disable it

### Disable universally

To disable this feature for all solutions, add this line at the end of your extension’s `activate` function to unregister the plugin:

```diff theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
const extension: ExtensionModule = {
  activate: async (configuration: Configuration) => {
    ...
+    delete configuration.pluginRegistry["menu-item"]["accelerator_plugin-menu-pivot-table-d2d"];
+    Object.values(configuration.pluginRegistry["widget"]).forEach(widgetPlugin => {
+        widgetPlugin.contextMenuItems = widgetPlugin.contextMenuItems.filter( menuItem => menuItem.key !== "accelerator_plugin-menu-pivot-table-d2d")
+    })
  }
}
```

### Disable for specific servers

To disable this feature for a given server, you must delete this feature’s settings for that server key by altering the `basSettings` parameter before calling the `activate` function.

**Example**
Disabling this feature for the `FRTB` server only:

```diff theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
+ import {produce} from "immer";
- import {activate as activateFrtb} from "@activeviam/frtb-sdk";
+ import {activate as activateFrtb, basSettings as frtbBASSettings} from "@activeviam/frtb-sdk";
 import {activate as activeMarketRisk} from "@activeviam/mr-sdk";

 const extension: ExtensionModule = {
  activate: async (configuration: Configuration) => {
    ...
+    const frtbBASSettingsWithFeatureDisabled = produce(frtbBASSettings, draft => {
+      delete draft["FRTB"]["bas-plugin-menu-item-daytoday"];
+    });

-   activateFrtb({configuration});
+   activateFrtb({configuration, basSetttings: frtbBASSettingsWithFeatureDisabled})
    activeMarketRisk({configuration});
  }
}
```
