# Operation APIs

The operation system definition for `cv.api` class (`cv.api.operation`). Contains all operation related API calls.

## Constructor

| Name              | Description                                                                        |
| ----------------- | ---------------------------------------------------------------------------------- |
| `new operation()` | Operation definition for `cv.api` class. Contains all operation related API calls. |

## Methods

| Name                                                                                  | Description                                                                                                                                                                          |
| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `clearCache(successCallback, errorCallback, suppressSuccessNotification)`             | Clears the entire cache associated with the current data source, including Analyzer's metadata cache, the Mondrian schema cache, and the Mondrian segment cache.                     |
| `clearDropTargetIndicator(dropTarget)`                                                | Clears a drop target indicator, provided there is a drop target. This can only be seen if an indicator has been shown previously for the given drop target.                          |
| `completeDrop(dropTarget)`                                                            | Completes the drop, provided there is a drop target. The result of this drop depends on the drop target and what custom drop action is bound to the specified drop target.           |
| \`getDropTarget(x, y, formula) : JSON                                                 | null\`                                                                                                                                                                               |
| `redo()`                                                                              | Reapplies events in the order they were removed or undone.                                                                                                                           |
| `refreshReport()`                                                                     | Refreshes the report, showing any changes made to the report.                                                                                                                        |
| `resetReport()`                                                                       | Resets the state of the report back to the most recently saved state.                                                                                                                |
| `saveReport(name, path, successCallback, errorCallback, suppressSuccessNotification)` | Saves the report.                                                                                                                                                                    |
| `showDropTargetIndicator(dropTarget)`                                                 | Shows the drop target indicator, provided there is a drop target. Depending on the portion of the screen where the drop is occurring, the drop indicator may look different or move. |
| `undo()`                                                                              | Removes events in the order they occurred.                                                                                                                                           |

## Constructor Details

| `new operation()`                                                                                                                                                                                                                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Operation definition for <code>cv.api</code> class. Contains all operation related API calls.</p><ul><li><strong>Source</strong></li></ul><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_operation.js#L28">javascript/scripts/cv\_api\_operation.js, line 28</a></p> |

\## Methods Details

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>clearCache(successCallback, errorCallback, suppressSuccessNotification)</code></td><td></td><td></td></tr><tr><td><p>Clears the entire cache associated with the current data source, including Analyzer's metadata cache, the Mondrian schema cache, and the Mondrian segment cache.</p><ul><li><strong>Since</strong></li></ul><p>5.4</p><ul><li><strong>Source</strong></li></ul><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_operation.js#L316">javascript/scripts/cv_api_operation.js, line 316</a></p><ul><li><strong>Parameters</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>var successCallback = function() {alert("Success!");}; var errorCallback = function() {alert("Error!");}; cv.api.operation.clearCache(successCallback, errorCallback, true);</p><pre><code>```
</code></pre></td><td></td><td></td></tr><tr><td>Name</td><td>Default Value</td><td>Summary</td></tr><tr><td><code>successCallback : function</code></td><td></td><td>The optional function which is executed when the report has been successfully saved.</td></tr><tr><td><code>errorCallback : function</code></td><td></td><td>The optional function which is executed when an exception is thrown when saving the report.</td></tr><tr><td><code>suppressSuccessNotification : boolean</code></td><td></td><td>The optional parameter which controls the display of the default success notification. By default, it is set to 'false'.</td></tr></tbody></table>

| Name                                    | Default Value | Summary                                                                                                                  |
| --------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `successCallback : function`            |               | The optional function which is executed when the report has been successfully saved.                                     |
| `errorCallback : function`              |               | The optional function which is executed when an exception is thrown when saving the report.                              |
| `suppressSuccessNotification : boolean` |               | The optional parameter which controls the display of the default success notification. By default, it is set to 'false'. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>clearDropTargetIndicator(dropTarget)</code></td><td></td><td></td></tr><tr><td><p>Clears a drop target indicator, provided there is a drop target. This can only be seen if an indicator has been shown previously for the given drop target.</p><ul><li><strong>Source</strong></li></ul><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_operation.js#L298">javascript/scripts/cv_api_operation.js, line 298</a></p><ul><li><strong>Parameters</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>var dropTarget = cv.api.operation.getDropTarget(0, 0, "[MDX].[Formula]"); cv.api.operation.clearDropTargetIndicator(dropTarget);</p><pre><code>```
</code></pre></td><td></td><td></td></tr><tr><td>Name</td><td>Default Value</td><td>Summary</td></tr><tr><td><code>dropTarget : JSON</code></td><td></td><td>The drop target, which represents the location upon which the user will drop a draggable object.</td></tr></tbody></table>

| Name                | Default Value | Summary                                                                                          |
| ------------------- | ------------- | ------------------------------------------------------------------------------------------------ |
| `dropTarget : JSON` |               | The drop target, which represents the location upon which the user will drop a draggable object. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>completeDrop</strong>(dropTarget)</td><td></td><td></td></tr><tr><td><p>Completes the drop, provided there is a drop target. The result of this drop depends on the drop target and what custom drop action is bound to the specified drop target.</p><ul><li><strong>Source</strong></li></ul><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_operation.js#L262">javascript/scripts/cv_api_operation.js, line 262</a></p><ul><li><strong>Parameters</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>var dropTarget = cv.api.operation.getDropTarget(0, 0, "[MDX].[Formula]"); cv.api.operation.completeDrop(dropTarget);</p><pre><code>```
</code></pre></td><td></td><td></td></tr><tr><td>Name</td><td>Default Value</td><td>Summary</td></tr><tr><td><code>dropTarget : JSON</code></td><td></td><td>The drop target, which represents the location upon which the user will drop a draggable object.</td></tr></tbody></table>

| Name                | Default Value | Summary                                                                                          |
| ------------------- | ------------- | ------------------------------------------------------------------------------------------------ |
| `dropTarget : JSON` |               | The drop target, which represents the location upon which the user will drop a draggable object. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>getDropTarget</strong>(x, y, formula) : <code>[JSON](http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON)</code> | <code>[null](http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null)</code></td><td></td><td></td></tr><tr><td><p>Retrieves the drop target, depending on the x and y coordinates provided. The x and y coordinates are relative to the frame in which analyzer is loaded, and not the parent frame. Any x and y coordinates from a parent window's mouse position needs to be translated such that (0, 0) is the top left corner of the frame.</p><ul><li><strong>Source</strong></li></ul><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_operation.js#L67">javascript/scripts/cv_api_operation.js, line 67</a></p><ul><li><strong>Parameters</strong></li><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre><code>
</code></pre></li></ul><p>cv.api.operation.getDropTarget(0, 0, "[MDX].[Formula]");</p><pre><code>```
</code></pre></td><td></td><td></td></tr><tr><td>Name</td><td>Default Value</td><td>Summary</td></tr><tr><td><code>x : integer</code></td><td></td><td>The x coordinate.</td></tr><tr><td><code>y : integer</code></td><td></td><td>The y coordinate.</td></tr><tr><td><code>formula : string</code></td><td></td><td>The MDX of the object which the user would want to drop onto Analyzer.</td></tr><tr><td>Name</td><td>Description</td><td></td></tr><tr><td>`JSON</td><td>null`</td><td></td></tr></tbody></table>

| Name   | Description |
| ------ | ----------- |
| \`JSON | null\`      |

| Name               | Default Value | Summary                                                                |
| ------------------ | ------------- | ---------------------------------------------------------------------- |
| `x : integer`      |               | The x coordinate.                                                      |
| `y : integer`      |               | The y coordinate.                                                      |
| `formula : string` |               | The MDX of the object which the user would want to drop onto Analyzer. |

<table data-header-hidden><thead><tr><th></th></tr></thead><tbody><tr><td><code>redo()</code></td></tr><tr><td><p>Reapplies events in the order they were removed or undone.</p><ul><li><strong>Since</strong></li></ul><p>5.4</p><ul><li><strong>Source</strong></li></ul><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_operation.js#L364">javascript/scripts/cv_api_operation.js, line 364</a></p><ul><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.operation.redo();</p><pre><code>```
</code></pre></td></tr></tbody></table>

<table data-header-hidden><thead><tr><th></th></tr></thead><tbody><tr><td><code>refreshReport()</code></td></tr><tr><td><p>Refreshes the report, showing any changes made to the report.</p><ul><li><strong>Source</strong></li></ul><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_operation.js#L47">javascript/scripts/cv_api_operation.js, line 47</a></p><ul><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.operation.refreshReport();</p><pre><code>```
</code></pre></td></tr></tbody></table>

<table data-header-hidden><thead><tr><th></th></tr></thead><tbody><tr><td><code>resetReport()</code></td></tr><tr><td><p>Resets the state of the report back to the most recently saved state.</p><ul><li><strong>Since</strong></li></ul><p>5.4</p><ul><li><strong>Source</strong></li></ul><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_operation.js#L385">javascript/scripts/cv_api_operation.js, line 385</a></p><ul><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.operation.resetReport();</p><pre><code>```
</code></pre></td></tr></tbody></table>

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>saveReport(name, path, successCallback, errorCallback, suppressSuccessNotification)</code></td><td></td><td></td></tr><tr><td><p>Saves the report.</p><ul><li><strong>Since:</strong></li></ul><p>5.4</p><ul><li><strong>Source</strong></li></ul><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_operation.js#L408">javascript/scripts/cv_api_operation.js, line 408</a></p><ul><li><strong>Parameters</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>var name = "Test name of report"; var path = "/public/my_test";</p><p>var successCallback = function() {alert("Success!");}; var errorCallback = function() {alert("Error!");};</p><p>cv.api.operation.saveReport(name, path, successCallback, errorCallback, true);</p><pre><code>```
</code></pre></td><td></td><td></td></tr><tr><td>Name</td><td>Default Value</td><td>Summary</td></tr><tr><td><code>name : string</code></td><td></td><td>The name of the report without extension.</td></tr><tr><td><code>path : string</code></td><td></td><td>The existing path of the repository to store the report without the report's name.</td></tr><tr><td><code>successCallback : function</code></td><td></td><td>The optional function that is executed when the report has been successfully saved.</td></tr><tr><td><code>errorCallback : function</code></td><td></td><td>The optional function that is executed when an exception was thrown during the saving of the report.</td></tr><tr><td><code>suppressSuccessNotification : boolean</code></td><td></td><td>The optional parameter to control displaying the default success notification. By default it's false.</td></tr></tbody></table>

| Name                                    | Default Value | Summary                                                                                               |
| --------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------- |
| `name : string`                         |               | The name of the report without extension.                                                             |
| `path : string`                         |               | The existing path of the repository to store the report without the report's name.                    |
| `successCallback : function`            |               | The optional function that is executed when the report has been successfully saved.                   |
| `errorCallback : function`              |               | The optional function that is executed when an exception was thrown during the saving of the report.  |
| `suppressSuccessNotification : boolean` |               | The optional parameter to control displaying the default success notification. By default it's false. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>showDropTargetIndicator(dropTarget)</code></td><td></td><td></td></tr><tr><td><p>Shows the drop target indicator, provided there is a drop target. Depending on the portion of the screen where the drop is occurring, the drop indicator may look different or move.</p><ul><li><strong>Source</strong></li></ul><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_operation.js#L280">javascript/scripts/cv_api_operation.js, line 280</a></p><ul><li><strong>Parameters</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>var dropTarget = cv.api.operation.getDropTarget(0, 0, "[MDX].[Formula]"); cv.api.operation.showDropTargetIndicator(dropTarget);</p><pre><code>```
</code></pre></td><td></td><td></td></tr><tr><td>Name</td><td>Default Value</td><td>Summary</td></tr><tr><td><code>dropTarget : JSON</code></td><td></td><td>The drop target, which represents the location upon which the user will drop a draggable object.</td></tr></tbody></table>

| Name                | Default Value | Summary                                                                                          |
| ------------------- | ------------- | ------------------------------------------------------------------------------------------------ |
| `dropTarget : JSON` |               | The drop target, which represents the location upon which the user will drop a draggable object. |

| `undo()`                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Removes events in the order they occurred.</p><ul><li><strong>Since:</strong></li></ul><p>5.4</p><ul><li><strong>Source</strong></li></ul><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_operation.js#L343">javascript/scripts/cv\_api\_operation.js, line 343</a></p><ul><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript"> |
| </code></pre></li></ul><p>cv.api.operation.undo(); \`\`\`</p>                                                                                                                                                                                                                                                                                                                                                                                                       |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pentaho.com/analyzer-external-javascript-api/cv-apis-pentaho-analyzer-external-javascript-api-cp/operation-apis-pentaho-analyzer-external-javascript-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
