Get Free Trial
API reference
Table of contents

ReportObject

All the possible aspects of pivot tables and pivot charts configuration can be set via the ReportObject. The component supports saving reports and loading previously saved ones.

For more details on the ReportObject usage, see this guide: Getting started with the report.

The ReportObject has the following properties:

  • dataSourceDataSourceObject. Contains information about the data source.
  • sliceSliceObject. There you can define fields that go to rows, go to columns and go to measures, add filtering, sorting, report filtering, expands, and drills.
  • optionsOptionsObject. Allows configuring the component’s UI and specifying functionality available to users.
  • conditions – Array of ConditionalFormatObjects.
  • formats – Array of FormatObjects.
  • tableSizesTableSizesObject. Contains information about table sizes.
  • customFields – Array of objects. Allows setting custom fields for Excel export or storing some additional information. They are not shown on the grid but they will be displayed in the exported Excel table. Each object has the following properties:
    • name – String. The custom field’s name.
    • value – String. The custom field’s value. This live sample on JSFiddle illustrates how to set the customFields property.
  • localization – String | Object. Allows localizing the component. The localization property can be either inline JSON or the URL to a localization JSON file. Learn more about setting localization in this tutorial: Localizing the component.
  • version – String. It contains the current version of Flexmonster.
  • creationDate – String. Represents the date (in ISO format) of the report creation.

You can get the report using getReport() API call. To set the report use setReport() API call.

To learn more about the ReportObject, refer to this tutorial: Getting started with the report.

Example

Example of the ReportObject:

{
    "dataSource": {
        "type": "json",
        "filename": "https://cdn.flexmonster.com/data/data.json",
        "mapping": {
            "Category": {
                "hierarchy": "Item"
            },
            "Color": {
                "hierarchy": "Item",
                "parent": "Category"
            },
            "Size": {
                "hierarchy": "Item",
                "parent": "Color"
            }
        }
    },
    "slice": {
        "rows": [
            {
                "uniqueName": "Item",
                "sort": "asc"
            }
        ],
        "columns": [
            {
                "uniqueName": "Country",
                "filter": {
                    "members": [
                        "country.[australia]",
                        "country.[france]",
                        "country.[united kingdom]"
                    ]
                },
                "sort": "asc"
            },
            {
                "uniqueName": "Business Type",
                "sort": "asc"
            },
            {
                "uniqueName": "[Measures]"
            }
        ],
        "measures": [
            {
                "uniqueName": "Price",
                "aggregation": "sum",
                "active": true,
                "format": "currency"
            }
        ],
        "sorting": {
            "row": {
                "type": "desc",
                "tuple": [
                    "item.[cars].[red]"
                ],
                "measure": {
                    "uniqueName": "Price",
                    "aggregation": "sum"
                }
            }
        },
        "expands": {
            "expandAll": false,
            "columns": [
                {
                    "tuple": [
                        "country.[australia]"
                    ]
                }
            ]
        },
        "drills": {
            "drillAll": false,
            "rows": [
                {
                    "tuple": [
                        "item.[accessories]"
                    ]
                },
                {
                    "tuple": [
                        "item.[cars]"
                    ]
                }
            ]
        }
    },
    "options": {
        "viewType": "grid",
        "grid": {
            "type": "compact",
            "title": "",
            "showFilter": true,
            "showHeaders": true,
            "showTotals": "on",
            "showGrandTotals": "on",
            "grandTotalsPosition": "top",
            "showExtraTotalLabels": false,
            "showHierarchies": true,
            "showHierarchyCaptions": true,
            "drillthroughMaxRows": 1000,
            "showReportFiltersArea": true,
            "dragging": true,
            "showAutoCalculationBar": true
        },
        "chart": {
            "type": "column",
            "title": "",
            "showFilter": true,
            "multipleMeasures": false,
            "oneLevel": false,
            "autoRange": false,
            "reversedAxes": false,
            "showLegend": true,
            "showLegendButton": false,
            "showDataLabels": false,
            "showAllLabels": false,
            "showMeasures": true,
            "showOneMeasureSelection": true,
            "showWarning": true,
            "activeMeasure": {}
        },
        "filter": {
            "weekOffset": 1,
            "dateFormat": "dd/MM/yyyy",
            "liveSearch": true
        },
        "configuratorActive": false,
        "configuratorButton": true,
        "showAggregations": true,
        "showCalculatedValuesButton": true,
        "grouping": false,
        "editing": false,
        "drillThrough": true,
        "showDrillThroughConfigurator": true,
        "sorting": "on",
        "defaultDateType": "date",
        "strictDataTypes": false,
        "datePattern": "dd/MM/yyyy",
        "dateTimePattern": "dd/MM/yyyy HH:mm:ss",
        "saveAllFormats": false,
        "showDefaultSlice": true,
        "useOlapFormatting": false,
        "showMemberProperties": false,
        "showEmptyData": true,
        "defaultHierarchySortName": "asc",
        "showOutdatedDataAlert": false,
        "showAggregationLabels": true,
        "showAllFieldsDrillThrough": false,
        "liveFiltering": false,
        "showFieldListSearch": false,
        "validateFormulas": true,
        "caseSensitiveMembers": false,
        "simplifyFieldListFolders": false,
        "validateReportFiles": true,
        "allowBrowsersCache": false,
        "showEmptyValues": false,
        "distinguishNullUndefinedEmpty": false,
        "useCaptionsInCalculatedValueEditor": false,
        "readOnly": false
    },
    "conditions": [
        {
            "formula": "#value < 20000",
            "measure": "Price",
            "aggregation": "sum",
            "format": {
                "backgroundColor": "#F44336",
                "color": "#FFFFFF",
                "fontFamily": "Arial",
                "fontSize": "12px"
            }
        }
    ],
    "formats": [
        {
            "name": "-currency",
            "currencySymbol": "$"
        }
    ],
    "tableSizes": {
        "columns": [
            {
                "tuple": [
                    "country.[australia]",
                    "business type.[warehouse]"
                ],
                "measure": {
                    "uniqueName": "Price",
                    "aggregation": "sum"
                },
                "width": 121
            }
        ]
    },
    "localization": "https://cdn.flexmonster.com/loc/es.json",
    "version": "2.9.8",
    "creationDate": "2021-09-22T11:54:40.925Z" 
}