# Report APIs

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

## Constructor

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

## Methods

| Name                                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `addLayoutField(gembarId, formula, gembarOrdinal)` | Adds a single gem to the gembar via its formula. The `gembarOrdinal` allows one to set the location of of the inserted gem.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `addSelectionFilter(selectionFilter)`              | Adds a selection filter.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `addSelectionFilters(selectionFilters)`            | Adds a list of selection filters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `buildCellActionContext(td) : JSON`                | Returns the context on a specific TD cell. The context will depend on the type of cell clicked. We only support providing context on member, measure, and 'data' cells. Cells are passed as parameters to listeners bound in event calls such as `registerTableClickListener`, `registerTableContextMenuListener`, etc., which can be used as the TD parameter for this endpoint.                                                                                                                                                                                                                                   |
| `buildFilterActionContext() : JSON`                | Returns the resolved filter context. 'Resolved' means that filters, such as the 'Last 30 Days' filter, will actually return the specified number of members, in this case '30 days', as opposed to the filter definition.                                                                                                                                                                                                                                                                                                                                                                                           |
| `getChartOption(name) : string`                    | Returns the value of the chart option by name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `getFieldOption(formula, name) : string`           | Returns the field option's value by name for a given formula.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `getFilters() : JSON`                              | Returns all level filters on the report.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `getLayoutFields(gembarId) : Array`                | Returns the array of formulas for the layout fields by gembarId.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `getName() : string`                               | Returns the name of the current report. New reports will return a null value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `getNumericFilters() : JSON`                       | Gets the measure filters for the report. Note that a report may only have a single level with a measure filter and that level must be displayed on the report.                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `getPath() : string`                               | Returns the path of the current saved report. New reports will return a null value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `getReportOption(name) : string`                   | Returns the value of the report option by name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `getSelectionFilters() : JSON`                     | Gets the selection filters for the report.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `getVizId() : string`                              | Returns the current visualization type id.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `isDirty() : boolean`                              | Returns as true if the report has pending changes which need to be saved.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `isNew() : boolean`                                | Returns as true if the report is new.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `removeFilters(level)`                             | Removes all non-numeric filters for a given level.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `removeLayoutField(gembarId, formula)`             | Removes a single gem from the gembar utilizing its formula as the key.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `removeNumericFilters()`                           | Removes all numeric filters on the report.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `removeSelectionFilters(noRefresh)`                | Removes all selection filters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `setChartOption(name, value)`                      | Sets the value in the chart option of the current report. This API function is additionally available via URL parameters for each chart option name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `setDatasource(catalog, cube)`                     | Sets a data source by its catalog name and cube name. Upon success, the report options are set on the report. After changing data sources, if invalid layout fields are present, they will be automatically removed.                                                                                                                                                                                                                                                                                                                                                                                                |
| `setFieldLink(formula, callback)`                  | Renders a hyperlink on all members/cells under the given level/measure. The input formula can either be a level or measure formula. If level formula, then all members under the level will have this link. If a level already specifies a content link, this API will override that link. If measure formula, then all table cells that contain this measure will have this link. If a measure already has a hyperlink such as if drilldown was enabled, this API will override that link. You do not need to refresh the report in order for the links to appear. They appear immediately after calling this API. |
| `setFieldOption(formula, name, value)`             | Sets option's value for formula by name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `setFilters(level, filterItems, forceAnd)`         | Sets filters on a level removing all previous filters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `setLayoutFields(gembarId, formulas)`              | Sets the array of formulas for the layout fields by gembarId. It overwrites the existing fields in the current gembar. Each formula is validated. If the formula is invalid, then it will not be set.                                                                                                                                                                                                                                                                                                                                                                                                               |
| `setNumericFilters(level, filterItems)`            | Sets a measure filter on a level. There can only be one measure filter per report. This method will remove any pre-existing measure filter on the report.                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `setReportOption(name, value)`                     | Sets the value of the report option. This API function is additionally available via URL parameters for each report option name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `setVizId(vizId)`                                  | Sets the report visualization using the visualization id. This api function is additionally available via the URL parameter 'vizID'.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

## Constructor Details

| `new report()`                                                                                                                                                                                                                                                                                                                                  |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Report definition for <code>cv.api</code> class. Contains all report 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_report.js#L32">javascript/scripts/cv\_api\_report.js, line 32</a></p> |

\## Methods Details

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>addLayoutField(gembarId, formula, gembarOrdinal)</code></td><td></td><td></td></tr><tr><td><p>Adds a single gem to the gembar via its formula. The gembarOrdinal allows one to set the location of of the inserted gem- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L275">javascript/scripts/cv_api_report.js, line 275</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 gembarId = "rows"; var formula = "[Markets].[City]"; var gembarOrdinal = 1;</p><p>cv.api.report.addLayoutField( gembarId, formula, gembarOrdinal );</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>gembarId : string</code></td><td></td><td>This is the id of the field. It depends on the visualization's type. For example, <code>PIVOT</code> allows values such as "rows", "columns", "measures".</td></tr><tr><td><code>formula : string</code></td><td></td><td>This is the String representation of the formula to insert as a gem.</td></tr><tr><td><code>gembarOrdinal : number</code></td><td></td><td>This is the index at which to insert the gem. A value of -1 appends to the end of the list.</td></tr></tbody></table>

| Name                     | Default Value | Summary                                                                                                                                        |
| ------------------------ | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `gembarId : string`      |               | This is the id of the field. It depends on the visualization's type. For example, `PIVOT` allows values such as "rows", "columns", "measures". |
| `formula : string`       |               | This is the String representation of the formula to insert as a gem.                                                                           |
| `gembarOrdinal : number` |               | This is the index at which to insert the gem. A value of -1 appends to the end of the list.                                                    |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>addSelectionFilter(selectionFilter)</code></td><td></td><td></td></tr><tr><td><p>Adds a selection filter.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L632">javascript/scripts/cv_api_report.js, line 632</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>cv.api.report.addSelectionFilter({ operator: "EXCLUDE", members: [{ formula: "[Geography].[TERRITORY]", member: "[Geography].[EMEA]" }] });</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>selectionFilter : JSON</code></td><td></td><td>The JSON representation of the selection filter item.</td></tr></tbody></table>

| Name                     | Default Value | Summary                                               |
| ------------------------ | ------------- | ----------------------------------------------------- |
| `selectionFilter : JSON` |               | The JSON representation of the selection filter item. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td>addSelectionFilters(selectionFilters)</td><td></td><td></td></tr><tr><td><p>Adds a list of selection filters.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L686">javascript/scripts/cv_api_report.js, line 686</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>cv.api.report.addSelectionFilters([{ operator: "EXCLUDE", members: [{ formula: "[Geography].[TERRITORY]", member: "[Geography].[EMEA]" }] }, { operator: "INCLUDE", members: [{ formula: "[Geography].[TERRITORY]", member: "[Geography].[APAC]" }] }]);</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>selectionFilters : JSON</code></td><td></td><td>The JSON representation of the selection filters item list.</td></tr></tbody></table>

| Name                      | Default Value | Summary                                                     |
| ------------------------- | ------------- | ----------------------------------------------------------- |
| `selectionFilters : JSON` |               | The JSON representation of the selection filters item list. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>buildCellActionContext(td) : JSON</code></td><td></td><td></td></tr><tr><td><p>Returns the context on a specific TD cell. The context will depend on the type of cell clicked. We only support providing context on member, measure, and 'data' cells. Cells are passed as parameters to listeners bound in event calls such as registerTableClickListener, registerTableContextMenuListener, etc., which can be used as the TD parameter for this endpoint.- <strong>Since</strong></p><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_report.js#L1470">javascript/scripts/cv_api_report.js, line 1470</a></p><ul><li><strong>Parameters</strong></li><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>var ctx = cv.api.report.buildCellActionContext(td);</p><p>// Return Value: { // "[Measures].[MeasuresLevel]" : "[Measures].[Sales]", // "[Markets].[Territory]" : "[Markets].[APAC]" // }</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>td : object</code></td><td></td><td>This is the HTML DOM object defining the TD cell of a table in a report.</td></tr><tr><td>Name</td><td>Description</td><td></td></tr><tr><td><code>JSON</code></td><td>This is the JSON object containing specific TD cell context.</td><td></td></tr></tbody></table>

| Name   | Description                                                  |
| ------ | ------------------------------------------------------------ |
| `JSON` | This is the JSON object containing specific TD cell context. |

| Name          | Default Value | Summary                                                                  |
| ------------- | ------------- | ------------------------------------------------------------------------ |
| `td : object` |               | This is the HTML DOM object defining the TD cell of a table in a report. |

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>buildFilterActionContext() : JSON</code></td><td></td></tr><tr><td><p>Returns the resolved filter context. 'Resolved' means that filters, such as the 'Last 30 Days' filter, will actually return the specified number of members, in this case '30 days', as opposed to the filter definition.- <strong>Since</strong></p><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_report.js#L1440">javascript/scripts/cv_api_report.js, line 1440</a></p><ul><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>var filterCtx = cv.api.report.buildFilterActionContext();</p><p>// Return Value: { // "[Markets].[Territory]" : { // "EQUAL" : ["[Markets].[APAC]"] // } // }</p><pre><code>```
</code></pre></td><td></td></tr><tr><td>Name</td><td>Description</td></tr><tr><td><code>JSON</code></td><td>This is the JSON object containing the filter context.</td></tr></tbody></table>

| Name   | Description                                            |
| ------ | ------------------------------------------------------ |
| `JSON` | This is the JSON object containing the filter context. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>getChartOption</strong>(name) : <code>[string](http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string)</code></td><td></td><td></td></tr><tr><td><p>Returns the value of the chart option by name.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L1241">javascript/scripts/cv_api_report.js, line 1241</a></p><ul><li><strong>Parameters</strong></li><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.report.getChartOption('legendPosition');</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>name of chart's option. Supported values: <code>legendPosition</code>, <code>showLegend</code>, <code>autoRange</code>, <code>valueAxisLowerLimit</code>, <code>valueAxisUpperLimit</code>, <code>displayUnits</code>, <code>autoRangeSecondary</code>, <code>valueAxisLowerLimitSecondary</code>, <code>valueAxisUpperLimitSecondary</code>, <code>displayUnitsSecondary</code>, <code>maxValues</code>, <code>backgroundColor</code>, <code>labelColor</code>, <code>labelSize</code>, <code>backgroundFill</code>, <code>maxChartsPerRow</code>, <code>multiChartRangeScope</code>, <code>emptyCellMode</code>, <code>sizeByNegativesMode</code>, <code>backgroundColorEnd</code>, <code>labelStyle</code>, <code>legendBackgroundColor</code>, <code>legendSize</code>, <code>legendColor</code>, <code>legendStyle</code>, <code>labelFontFamily</code>, <code>legendFontFamily</code></td></tr><tr><td>Name</td><td>Description</td><td></td></tr><tr><td><code>string</code></td><td>This is the value of the chart option.</td><td></td></tr></tbody></table>

| Name     | Description                            |
| -------- | -------------------------------------- |
| `string` | This is the value of the chart option. |

| Name            | Default Value | Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| --------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name : string` |               | name of chart's option. Supported values: `legendPosition`, `showLegend`, `autoRange`, `valueAxisLowerLimit`, `valueAxisUpperLimit`, `displayUnits`, `autoRangeSecondary`, `valueAxisLowerLimitSecondary`, `valueAxisUpperLimitSecondary`, `displayUnitsSecondary`, `maxValues`, `backgroundColor`, `labelColor`, `labelSize`, `backgroundFill`, `maxChartsPerRow`, `multiChartRangeScope`, `emptyCellMode`, `sizeByNegativesMode`, `backgroundColorEnd`, `labelStyle`, `legendBackgroundColor`, `legendSize`, `legendColor`, `legendStyle`, `labelFontFamily`, `legendFontFamily` |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>getFieldOption(formula, name) : string</code></td><td></td><td></td></tr><tr><td><p>Returns the field option's value by name for a given formula.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L1051">javascript/scripts/cv_api_report.js, line 1051</a></p><ul><li><strong>Parameters</strong></li><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.report.getFieldOption("[Markets].[Territory]", "showSubtotal");</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>formula : string</code></td><td></td><td>string representation of the formula</td></tr><tr><td><code>name : string</code></td><td></td><td>name of field's option. Supported values: <code>label</code>, <code>sortOrderEnum</code>, <code>showAggregate</code>, <code>showSum</code>, <code>showAverage</code>, <code>showMin</code>, <code>showMax</code>, <code>formatShortcut</code>, <code>formatCategory</code>, <code>formatScale</code>, <code>formatExpression</code>, <code>currencySymbol</code>, <code>showSubtotal</code></td></tr><tr><td>Name</td><td>Description</td><td></td></tr><tr><td><code>string</code></td><td>Option's value.</td><td></td></tr></tbody></table>

| Name     | Description     |
| -------- | --------------- |
| `string` | Option's value. |

| Name               | Default Value | Summary                                                                                                                                                                                                                                      |
| ------------------ | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `formula : string` |               | string representation of the formula                                                                                                                                                                                                         |
| `name : string`    |               | name of field's option. Supported values: `label`, `sortOrderEnum`, `showAggregate`, `showSum`, `showAverage`, `showMin`, `showMax`, `formatShortcut`, `formatCategory`, `formatScale`, `formatExpression`, `currencySymbol`, `showSubtotal` |

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>getFilters() : JSON</code></td><td></td></tr><tr><td><p>Returns all level filters on the report.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L747">javascript/scripts/cv_api_report.js, line 747</a></p><ul><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.report.getFilters();</p><p>// Return Value: { // "filters": {"[Time].[Years]": [ // {"operator": "EQUAL", "members": [ // {"formula": "[Time].[2003]", "caption": "2003"}, // {"formula": "[Time].[2004]", "caption": "2004"}, // {"formula": "[Time].[2005]", "caption": "2005"} // ]} // ]} // }</p><pre><code>```
</code></pre></td><td></td></tr><tr><td>Name</td><td>Description</td></tr><tr><td><code>JSON</code></td><td>JSON filters This is a JSON object containing all level filters.</td></tr></tbody></table>

| Name   | Description                                                      |
| ------ | ---------------------------------------------------------------- |
| `JSON` | JSON filters This is a JSON object containing all level filters. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>getLayoutFields</strong>(gembarId) : <code>[Array](http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)</code></td><td></td><td></td></tr><tr><td><p>Returns the array of formulas for the layout fields by gembarId.</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_report.js#L197">javascript/scripts/cv_api_report.js, line 197</a></p><ul><li><strong>Parameters</strong></li><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>var gembarId = "rows"; cv.api.report.getLayoutFields(gembarId);</p><p>// Return Value: ["[Markets].[Territory]", "[Markets].[Country]"]</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>gembarId : string</code></td><td></td><td>This is the id of the field. It depends on the visualization's type. For example, <code>PIVOT</code> allows values such as "rows", "columns", "measures".</td></tr><tr><td>Name</td><td>Description</td><td></td></tr><tr><td><code>Array</code></td><td>This is the array of formulas.</td><td></td></tr></tbody></table>

| Name    | Description                    |
| ------- | ------------------------------ |
| `Array` | This is the array of formulas. |

| Name                | Default Value | Summary                                                                                                                                        |
| ------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `gembarId : string` |               | This is the id of the field. It depends on the visualization's type. For example, `PIVOT` allows values such as "rows", "columns", "measures". |

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>getName() : string</code></td><td></td></tr><tr><td><p>Returns the name of the current report. New reports will return a null value.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L355">javascript/scripts/cv_api_report.js, line 355</a></p><ul><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>var gembarId = "rows"; cv.api.report.getLayoutFields(gembarId);</p><p>// Return Value: ["[Markets].[Territory]", "[Markets].[Country]"]</p><pre><code>```
</code></pre></td><td></td></tr><tr><td>Name</td><td>Description</td></tr><tr><td><code>string</code></td><td>Name of the current report.</td></tr></tbody></table>

| Name     | Description                 |
| -------- | --------------------------- |
| `string` | Name of the current report. |

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>getNumericFilters() : JSON</code></td><td></td></tr><tr><td><p>Gets the measure filters for the report. Note that a report may only have a single level with a measure filter and that level must be displayed on the report.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L405">javascript/scripts/cv_api_report.js, line 405</a></p><ul><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.report.getNumericFilters();</p><p>// Return Value: { // "filters": { // "[Markets].[Territory]": [ // {"count": "10", "formula": "[Measures].[Sales]", "operator": "TOP"}, // {"operator": "GREATER_THAN", "formula": "[Measures].[Sales]", "op1": "0.0"}, // {"operator": "LESS_THAN", "formula": "[Measures].[Sales]", "op1": "100000000000"}, // {"operator": "IS_NOT_EMPTY", "formula": "[Measures].[Sales]"} // ] // } // }</p><pre><code>```
</code></pre></td><td></td></tr><tr><td>Name</td><td>Description</td></tr><tr><td><code>JSON</code></td><td>All filters in a JSON object.</td></tr></tbody></table>

| Name   | Description                   |
| ------ | ----------------------------- |
| `JSON` | All filters in a JSON object. |

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>getPath() : string</code></td><td></td></tr><tr><td><p>Returns the path of the current saved report. New reports will return a null value.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L380">javascript/scripts/cv_api_report.js, line 380</a></p><ul><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.report.getPath();</p><p>// Return Value: "/public/Steel Wheels/Country Performance (heat grid).xanalyzer"</p><pre><code>```
</code></pre></td><td></td></tr><tr><td>Name</td><td>Description</td></tr><tr><td><code>string</code></td><td>The report's path.</td></tr></tbody></table>

| Name     | Description        |
| -------- | ------------------ |
| `string` | The report's path. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>getReportOption(name) : string</code></td><td></td><td></td></tr><tr><td><p>Returns the value of the report option by name.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L1179">javascript/scripts/cv_api_report.js, line 1179</a></p><ul><li><strong>Parameters</strong></li><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.report.getReportOption('showRowGrandTotal');</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>name of report's option. Supported values: <code>showRowGrandTotal</code>, <code>showColumnGrandTotal</code>, <code>useNonVisualTotals</code>, <code>showEmptyCells</code>, <code>showDrillLinks</code>, <code>autoRefresh</code>, <code>freezeColumns</code>, <code>freezeRows</code></td></tr><tr><td>Name</td><td>Description</td><td></td></tr><tr><td><code>string</code></td><td>This is the value of the report option.</td><td></td></tr></tbody></table>

| Name     | Description                             |
| -------- | --------------------------------------- |
| `string` | This is the value of the report option. |

| Name            | Default Value | Summary                                                                                                                                                                                        |
| --------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name : string` |               | name of report's option. Supported values: `showRowGrandTotal`, `showColumnGrandTotal`, `useNonVisualTotals`, `showEmptyCells`, `showDrillLinks`, `autoRefresh`, `freezeColumns`, `freezeRows` |

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>getSelectionFilters() : JSON</code></td><td></td></tr><tr><td><p>Gets the selection filters for the report.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L557">javascript/scripts/cv_api_report.js, line 557</a></p><ul><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.report.getSelectionFilters();</p><p>// Return Value: { // "selectionFilters": [{ // "operator": "EXCLUDE", // "members": [{ // "formula": "[Geography].[TERRITORY]", // "member": "[Geography].[EMEA]" // }] // }] // }</p><pre><code>```
</code></pre></td><td></td></tr><tr><td>Name</td><td>Description</td></tr><tr><td><code>JSON</code></td><td>All selection filters in a JSON object.</td></tr></tbody></table>

| Name   | Description                             |
| ------ | --------------------------------------- |
| `JSON` | All selection filters in a JSON object. |

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>getVizId() : string</code></td><td></td></tr><tr><td><p>Returns the current visualization type id.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L995">javascript/scripts/cv_api_report.js, line 995</a></p><ul><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.report.getVizId();</p><p>// Return Value: "ccc_bar"</p><pre><code>```
</code></pre></td><td></td></tr><tr><td>Name</td><td>Description</td></tr><tr><td><code>string</code></td><td>The id of the visualization type.</td></tr></tbody></table>

| Name     | Description                       |
| -------- | --------------------------------- |
| `string` | The id of the visualization type. |

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>isDirty() : boolean</code></td><td></td></tr><tr><td><p>Returns as true if the report has pending changes which need to be saved.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L1139">javascript/scripts/cv_api_report.js, line 1139</a></p><ul><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.report.isDirty();</p><pre><code>```
</code></pre></td><td></td></tr><tr><td>Name</td><td>Description</td></tr><tr><td><code>boolean</code></td><td>True if report has pending changes and false if no pending changes are present.</td></tr></tbody></table>

| Name      | Description                                                                     |
| --------- | ------------------------------------------------------------------------------- |
| `boolean` | True if report has pending changes and false if no pending changes are present. |

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>isNew() : boolean</code></td><td></td></tr><tr><td><p>Returns as true if the report is new.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L1159">javascript/scripts/cv_api_report.js, line 1159</a></p><ul><li><strong>Returns</strong></li><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.report.isNew();</p><pre><code>```
</code></pre></td><td></td></tr><tr><td>Name</td><td>Description</td></tr><tr><td><code>boolean</code></td><td>True if report is new and false if the report is not new.</td></tr></tbody></table>

| Name      | Description                                               |
| --------- | --------------------------------------------------------- |
| `boolean` | True if report is new and false if the report is not new. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>removeFilters(level)</code></td><td></td><td></td></tr><tr><td><p>Removes all non-numeric filters for a given level.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L957">javascript/scripts/cv_api_report.js, line 957</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>cv.api.report.removeFilters("[Markets].[Territory]");</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>level : string</code></td><td></td><td>This is the level on which the filter is being removed.</td></tr></tbody></table>

| Name             | Default Value | Summary                                                 |
| ---------------- | ------------- | ------------------------------------------------------- |
| `level : string` |               | This is the level on which the filter is being removed. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>removeLayoutField(gembarId, formula)</code></td><td></td><td></td></tr><tr><td><p>Removes a single gem from the gembar utilizing its formula as the key.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L322">javascript/scripts/cv_api_report.js, line 322</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 gembarId = "rows"; var formula = "[Markets].[City]";</p><p>cv.api.report.removeLayoutField(gembarId, 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>gembarId : string</code></td><td></td><td>This is the id of the field. It depends on the visualization's type. For example, <code>PIVOT</code> allows values such as "rows", "columns", "measures".</td></tr><tr><td><code>formula : string</code></td><td></td><td>This is the string representation of the formula to insert as a gem.</td></tr></tbody></table>

| Name                | Default Value | Summary                                                                                                                                        |
| ------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `gembarId : string` |               | This is the id of the field. It depends on the visualization's type. For example, `PIVOT` allows values such as "rows", "columns", "measures". |
| `formula : string`  |               | This is the string representation of the formula to insert as a gem.                                                                           |

<table data-header-hidden><thead><tr><th></th></tr></thead><tbody><tr><td><code>removeNumericFilters()</code></td></tr><tr><td><p>Removes all numeric filters on the report.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L977">javascript/scripts/cv_api_report.js, line 977</a></p><ul><li><p><strong>Example</strong></p><pre class="language-javascript"><code class="lang-javascript">
</code></pre></li></ul><p>cv.api.report.removeNumericFilters();</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>removeSelectionFilters(noRefresh)</code></td><td></td><td></td></tr><tr><td><p>Removes all selection filters.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L727">javascript/scripts/cv_api_report.js, line 727</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>cv.api.report.removeSelectionFilters();</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>noRefresh : boolean</code></td><td></td><td>Controls report refresh when removing selection filters.</td></tr></tbody></table>

| Name                  | Default Value | Summary                                                  |
| --------------------- | ------------- | -------------------------------------------------------- |
| `noRefresh : boolean` |               | Controls report refresh when removing selection filters. |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>setChartOption(name, value)</code></td><td></td><td></td></tr><tr><td><p>Sets the value in the chart option of the current report. This API function is additionally available via URL parameters for each chart option name.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L1269">javascript/scripts/cv_api_report.js, line 1269</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>cv.api.report.setChartOption('legendPosition', 'TOP');</p><p>http://sample.url.com?showLegend=true&#x26;legendPosition=LEFT&#x26;legendBackgroundColor=%23EEAADD&#x26;legendSize=12&#x26;legendColor=%23AA11AA&#x26;legendStyle=BOLD&#x26;legendFontFamily=Times%20New%20Roman&#x26;backgroundFill=SOLID&#x26;backgroundColor=%23DDBBCC&#x26;labelColor=%23FF2322&#x26;labelSize=14&#x26;backgroundColorEnd=%23EEAADD&#x26;labelStyle=BOLD&#x26;labelFontFamily=Times%20New%20Roman&#x26;autoRange=false&#x26;autoRangeSecondary=false&#x26;displayUnits=UNITS_2&#x26;displayUnitsSecondary=UNITS_2&#x26;valueAxisLowerLimit=500&#x26;valueAxisUpperLimit=9000&#x26;valueAxisLowerLimitSecondary=4&#x26;valueAxisUpperLimitSecondary=55.5&#x26;maxValues=3&#x26;maxChartsPerRow=2&#x26;multiChartRangeScope=GLOBAL&#x26;emptyCellMode=GAP&#x26;sizeByNegativesMode=USE_ABS</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>name of chart's option. Supported values: <code>legendPosition</code>, <code>showLegend</code>, <code>autoRange</code>, <code>valueAxisLowerLimit</code>, <code>valueAxisUpperLimit</code>, <code>displayUnits</code>, <code>autoRangeSecondary</code>, <code>valueAxisLowerLimitSecondary</code>, <code>valueAxisUpperLimitSecondary</code>, <code>displayUnitsSecondary</code>, <code>maxValues</code>, <code>backgroundColor</code>, <code>labelColor</code>, <code>labelSize</code>, <code>backgroundFill</code>, <code>maxChartsPerRow</code>, <code>multiChartRangeScope</code>, <code>emptyCellMode</code>, <code>sizeByNegativesMode</code>, <code>backgroundColorEnd</code>, <code>labelStyle</code>, <code>legendBackgroundColor</code>, <code>legendSize</code>, <code>legendColor</code>, <code>legendStyle</code>, <code>labelFontFamily</code>, <code>legendFontFamily</code></td></tr><tr><td><code>value : string</code></td><td></td><td>This is the value of the chart's option.</td></tr></tbody></table>

| Name             | Default Value | Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name : string`  |               | name of chart's option. Supported values: `legendPosition`, `showLegend`, `autoRange`, `valueAxisLowerLimit`, `valueAxisUpperLimit`, `displayUnits`, `autoRangeSecondary`, `valueAxisLowerLimitSecondary`, `valueAxisUpperLimitSecondary`, `displayUnitsSecondary`, `maxValues`, `backgroundColor`, `labelColor`, `labelSize`, `backgroundFill`, `maxChartsPerRow`, `multiChartRangeScope`, `emptyCellMode`, `sizeByNegativesMode`, `backgroundColorEnd`, `labelStyle`, `legendBackgroundColor`, `legendSize`, `legendColor`, `legendStyle`, `labelFontFamily`, `legendFontFamily` |
| `value : string` |               | This is the value of the chart's option.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>setDatasource(catalog, cube)</code></td><td></td><td></td></tr><tr><td><p>Sets a data source by its catalog name and cube name. Upon success, the report options are set on the report. After changing data sources, if invalid layout fields are present, they will be automatically removed.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L1303">javascript/scripts/cv_api_report.js, line 1303</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>cv.api.report.setDatasource("SteelWheels", "SteelWheelsSales")</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>catalog : string</code></td><td></td><td>The name of the catalog.</td></tr><tr><td><code>cube : string</code></td><td></td><td>The name of the cube.</td></tr></tbody></table>

| Name               | Default Value | Summary                  |
| ------------------ | ------------- | ------------------------ |
| `catalog : string` |               | The name of the catalog. |
| `cube : string`    |               | The name of the cube.    |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>setFieldLink(formula, callback)</code></td><td></td><td></td></tr><tr><td><p>Renders a hyperlink on all members/cells under the given level/measure. The input formula can either be a level or measure formula. If level formula, then all members under the level will have this link. If a level already specifies a content link, this API will override that link. If measure formula, then all table cells that contain this measure will have this link. If a measure already has a hyperlink such as if drilldown was enabled, this API will override that link. You do not need to refresh the report in order for the links to appear. They appear immediately after calling this API.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L1348">javascript/scripts/cv_api_report.js, line 1348</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 callback = function(api, ctx, filterCtx) { // Perform Action on api.* };</p><p>cv.api.report.setFieldLink("[Markets].[Territory]", callback);</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>formula : string</code></td><td></td><td>This is the String representation of the formula to set a link.</td></tr><tr><td><code>callback : function</code></td><td></td><td>The function that is executed when you click on link.</td></tr></tbody></table>

| Name                  | Default Value | Summary                                                         |
| --------------------- | ------------- | --------------------------------------------------------------- |
| `formula : string`    |               | This is the String representation of the formula to set a link. |
| `callback : function` |               | The function that is executed when you click on link.           |

| `setFieldOption(formula, name, value)`                                                                                                                                                                                                                                                                                                                                                                                         |               |                                                                                                                                                                                                                                              |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Sets option's value for formula by name.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L1099">javascript/scripts/cv\_api\_report.js, line 1099</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>cv.api.report.setFieldOption("\[Markets].\[Territory]", "label", "My Territory"); \`\`\`</p>                                                                                                                                                                                                                                                                                                         |               |                                                                                                                                                                                                                                              |
| Name                                                                                                                                                                                                                                                                                                                                                                                                                           | Default Value | Summary                                                                                                                                                                                                                                      |
| `formula : string`                                                                                                                                                                                                                                                                                                                                                                                                             |               | string representation of the formula                                                                                                                                                                                                         |
| `name : string`                                                                                                                                                                                                                                                                                                                                                                                                                |               | name of field's option. Supported values: `label`, `sortOrderEnum`, `showAggregate`, `showSum`, `showAverage`, `showMin`, `showMax`, `formatShortcut`, `formatCategory`, `formatScale`, `formatExpression`, `currencySymbol`, `showSubtotal` |
| `value : string`                                                                                                                                                                                                                                                                                                                                                                                                               |               | Value of field's option.                                                                                                                                                                                                                     |

| Name               | Default Value | Summary                                                                                                                                                                                                                                      |
| ------------------ | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `formula : string` |               | string representation of the formula                                                                                                                                                                                                         |
| `name : string`    |               | name of field's option. Supported values: `label`, `sortOrderEnum`, `showAggregate`, `showSum`, `showAverage`, `showMin`, `showMax`, `formatShortcut`, `formatCategory`, `formatScale`, `formatExpression`, `currencySymbol`, `showSubtotal` |
| `value : string`   |               | Value of field's option.                                                                                                                                                                                                                     |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>setFilters(level, filterItems, forceAnd)</code></td><td></td><td></td></tr><tr><td><p>Sets filters on a level removing all previous filters.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L840">javascript/scripts/cv_api_report.js, line 840</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>cv.api.report.setFilters("[Time].[Years]", [ { // Builds a relative equal filter for Previous, Current, and Next on Years "operator": "EQUAL", "members": [-1, 0, 1] }, { // Builds an exact equal filter on Years "operator": "EQUAL", "members": [ { "formula": "[Time].[2003]", "caption": "2003" }, { "formula": "[Time].[2004]", "caption": "2004" }, { "formula": "[Time].[2005]", "caption": "2005" }] }, { "operator": "TIME_RANGE_PREV", "members": [10] }, { "operator": "TIME_RANGE_NEXT", "members": [10] }, { "operator": "TIME_AGO", "members": [10] }, { "operator": "TIME_AHEAD", "members": [10] }, { "operator": "BETWEEN", "members": [ {"formula": "[Time].[2003]", "caption": "2003"}, {"formula": "[Time].[2005]","caption": "2005"}] }, { "operator": "NUMERIC_GREATER_THAN", "op1": 500 }, { "operator": "NUMERIC_BETWEEN", "op1" : 10, "op2" : 20 } ]);</p><p>cv.api.report.setFilters("[Markets].[Territory]", [{ "operator": "CONTAIN", "members": ["APAC"] }]);</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>level : string</code></td><td></td><td>This is the level on which the filter is being set.</td></tr><tr><td><code>filterItems : JSON</code></td><td></td><td>A JSON filter representation. Supported Operators: <code>EQUAL</code>, <code>NOT_EQUAL</code>, <code>CONTAIN</code>, <code>NOT_CONTAIN</code>, <code>BEFORE</code>, <code>AFTER</code>, <code>BETWEEN</code>, <code>TIME_AGO</code>,<code>TIME_AHEAD</code>, <code>TIME_YAGO</code>, <code>TIME_RANGE_PREV</code>, <code>TIME_RANGE_NEXT</code>, <code>NUMERIC_BETWEEN</code>, <code>NUMERIC_GREATER_THAN</code>,<code>NUMERIC_GREATER_THAN_EQUAL</code>,<code>NUMERIC_LESS_THAN</code>, <code>NUMERIC_LESS_THAN_EQUAL</code></td></tr><tr><td><code>forceAnd : boolean</code></td><td></td><td></td></tr></tbody></table>

| Name                 | Default Value | Summary                                                                                                                                                                                                                                                                                                                            |
| -------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `level : string`     |               | This is the level on which the filter is being set.                                                                                                                                                                                                                                                                                |
| `filterItems : JSON` |               | A JSON filter representation. Supported Operators: `EQUAL`, `NOT_EQUAL`, `CONTAIN`, `NOT_CONTAIN`, `BEFORE`, `AFTER`, `BETWEEN`, `TIME_AGO`,`TIME_AHEAD`, `TIME_YAGO`, `TIME_RANGE_PREV`, `TIME_RANGE_NEXT`, `NUMERIC_BETWEEN`, `NUMERIC_GREATER_THAN`,`NUMERIC_GREATER_THAN_EQUAL`,`NUMERIC_LESS_THAN`, `NUMERIC_LESS_THAN_EQUAL` |
| `forceAnd : boolean` |               |                                                                                                                                                                                                                                                                                                                                    |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>setLayoutFields(gembarId, formulas)</code></td><td></td><td></td></tr><tr><td><p>Sets the array of formulas for the layout fields by gembarId. It overwrites the existing fields in the current gembar. Each formula is validated. If the formula is invalid, then it will not be set.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L226">javascript/scripts/cv_api_report.js, line 226</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 gembarId = "rows"; var formulas = [ "[Markets].[Territory]", "[Markets].[Country]" ];</p><p>cv.api.report.setLayoutFields(gembarId, formulas);</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>gembarId : string</code></td><td></td><td>This is the id of the field. It depends on the visualization's type. For example, <code>PIVOT</code> allows values such as "rows", "columns", "measures".</td></tr><tr><td><code>formulas : Array</code></td><td></td><td>This is the array of strings of formulas.</td></tr></tbody></table>

| Name                | Default Value | Summary                                                                                                                                        |
| ------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `gembarId : string` |               | This is the id of the field. It depends on the visualization's type. For example, `PIVOT` allows values such as "rows", "columns", "measures". |
| `formulas : Array`  |               | This is the array of strings of formulas.                                                                                                      |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>setNumericFilters(level, filterItems)</code></td><td></td><td></td></tr><tr><td><p>Sets a measure filter on a level. There can only be one measure filter per report. This method will remove any pre-existing measure filter on the report.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L477">javascript/scripts/cv_api_report.js, line 477</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 filterItems = [ {"count": "10", "formula": "[Measures].[Sales]", "operator": "TOP"}, {"operator": "GREATER_THAN", "formula": "[Measures].[Sales]", "op1": "0.0"}, {"operator": "LESS_THAN", "formula": "[Measures].[Sales]", "op1": "100000000000"}, {"operator": "IS_NOT_EMPTY", "formula": "[Measures].[Sales]"} ];</p><p>cv.api.report.setNumericFilters("[Markets].[Territory]", filterItems);</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>level : string</code></td><td></td><td>This is the level on which the filter is being set.</td></tr><tr><td><code>filterItems : JSON</code></td><td></td><td>A JSON filter representation. Supported Operators: <code>LESS_THAN</code>, <code>GREATER_THAN</code>, <code>LESS_THAN_EQUAL</code>, <code>GREATER_THAN_EQUAL</code>, <code>EQUAL</code>, <code>NOT_EQUAL</code>, <code>BETWEEN</code>, <code>IS_NOT_EMPTY</code>, <code>TOP</code>, <code>BOTTOM</code>, <code>TOP_BOTTOM</code></td></tr></tbody></table>

| Name                 | Default Value | Summary                                                                                                                                                                                                 |
| -------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `level : string`     |               | This is the level on which the filter is being set.                                                                                                                                                     |
| `filterItems : JSON` |               | A JSON filter representation. Supported Operators: `LESS_THAN`, `GREATER_THAN`, `LESS_THAN_EQUAL`, `GREATER_THAN_EQUAL`, `EQUAL`, `NOT_EQUAL`, `BETWEEN`, `IS_NOT_EMPTY`, `TOP`, `BOTTOM`, `TOP_BOTTOM` |

| `setReportOption(name, value)`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |               |                                                                                                                                                                                                |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Sets the value of the report option. This API function is additionally available via URL parameters for each report option name.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L1202">javascript/scripts/cv\_api\_report.js, line 1202</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>cv.api.report.setReportOption('showRowGrandTotal', 'true');</p><p><http://sample.url.com?showRowGrandTotal=true&#x26;showColumnGrandTotal=true&#x26;useNonVisualTotals=true&#x26;showEmptyCells=true&#x26;showDrillLinks=true&#x26;autoRefresh=true&#x26;freezeColumns=true&#x26;freezeRows> \`\`\`</p>                                                                                                                                                                                      |               |                                                                                                                                                                                                |
| Name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Default Value | Summary                                                                                                                                                                                        |
| `name : string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |               | name of report's option. Supported values: `showRowGrandTotal`, `showColumnGrandTotal`, `useNonVisualTotals`, `showEmptyCells`, `showDrillLinks`, `autoRefresh`, `freezeColumns`, `freezeRows` |
| `value : string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |               | This is the value of the report's option.                                                                                                                                                      |

| Name             | Default Value | Summary                                                                                                                                                                                        |
| ---------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name : string`  |               | name of report's option. Supported values: `showRowGrandTotal`, `showColumnGrandTotal`, `useNonVisualTotals`, `showEmptyCells`, `showDrillLinks`, `autoRefresh`, `freezeColumns`, `freezeRows` |
| `value : string` |               | This is the value of the report's option.                                                                                                                                                      |

<table data-header-hidden><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>setVizId(vizId)</code></td><td></td><td></td></tr><tr><td><p>Sets the report visualization using the visualization id. This api function is additionally available via the URL parameter 'vizId'.- <strong>Source</strong></p><p><a href="https://github.com/pentaho/pentaho-analyzer/tree/master/b/pentaho/p-analyzer/client/src/main/javascript/scripts/cv_api_report.js#L1020">javascript/scripts/cv_api_report.js, line 1020</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>cv.api.report.setVizId("ccc_bar");</p><p>http://sample.url.com?vizId=ccc_bar</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>vizId : string</code></td><td></td><td>This is the id of the visualization. Possible values are <code>pivot</code>, <code>ccc_bar</code>, <code>ccc_barstacked</code>, <code>ccc_barnormalized</code>, <code>ccc_horzbar</code>, <code>ccc_horzbarstacked</code>, <code>ccc_horzbarnormalized</code>, <code>ccc_pie</code>, <code>ccc_line</code>, <code>ccc_area</code>, <code>ccc_scatter</code>, <code>ccc_barline</code>, <code>ccc_heatgrid</code>, <code>ccc_sunburst</code>, <code>open_layers</code>.</td></tr></tbody></table>

| Name             | Default Value | Summary                                                                                                                                                                                                                                                                                           |
| ---------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `vizId : string` |               | This is the id of the visualization. Possible values are `pivot`, `ccc_bar`, `ccc_barstacked`, `ccc_barnormalized`, `ccc_horzbar`, `ccc_horzbarstacked`, `ccc_horzbarnormalized`, `ccc_pie`, `ccc_line`, `ccc_area`, `ccc_scatter`, `ccc_barline`, `ccc_heatgrid`, `ccc_sunburst`, `open_layers`. |


---

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