1. API reference
  2. Welcome
    1. Component overview
    2. Quick start
    3. System requirements
    4. Troubleshooting
    5. Managing license keys
  3. Connecting to Data Source
    1. JSON
      1. Connecting to JSON
      2. Connecting to JSON using the Data Compressor
      3. Data types in JSON
    2. CSV
      1. Connecting to CSV
      2. Connecting to CSV using the Data Compressor
      3. Data types in CSV
    3. Database
      1. Connecting to SQL databases
      2. Connecting to other databases
      3. Connecting to a database with Node.js
      4. Connecting to a database with .NET
      5. Connecting to a database with .NET Core
      6. Connecting to a database with Java
      7. Connecting to a database with PHP
    4. Microsoft Analysis Services
      1. Connecting to Microsoft Analysis Services
      2. Getting started with the Accelerator
      3. Installing the Accelerator as a Windows service
      4. Referring the Accelerator as a DLL
      5. Configuring the authentication process
      6. Configuring a secure HTTPS connection
      7. Troubleshooting
    5. Pentaho Mondrian
      1. Connecting to Pentaho Mondrian
      2. Getting started with the Accelerator
      3. Configuring Mondrian roles
      4. Configuring username/password protection
      5. Configuring a secure HTTPS connection
      6. Troubleshooting
    6. Elasticsearch
      1. Connecting to Elasticsearch
      2. Configuring the mapping
  4. Security
    1. Security in Flexmonster
    2. Security aspects when connecting to an OLAP cube
      1. The data transfer process
      2. Data security
      3. Data access management
    3. Security aspects when connecting to a database
      1. The data transfer process
      2. Data access management
  5. Configuring report
    1. What is a report
    2. Data source
    3. Slice
    4. Options
    5. Number formatting
    6. Conditional formatting
    7. Set the report for the component
    8. Get the report from the component
    9. Date and time formatting
    10. Configuring global options
    11. Export and print
    12. Calculated values
    13. Custom sorting
  6. Integration with frameworks
    1. Available tutorials
    2. Integration with AngularJS (v1.x)
    3. Integration with Angular
    4. Integration with React
    5. Integration with Webpack
    6. Integration with ASP.NET
    7. Integration with jQuery
    8. Integration with JSP
    9. Integration with TypeScript
    10. Integration with RequireJS
    11. Integration with PhoneGap
  7. Integration with charts
    1. Integration with Highcharts
    2. Integration with Google Charts
    3. Integration with FusionCharts
    4. Integration with any charting library
  8. Customizing
    1. Customizing toolbar
    2. Customizing appearance
    3. Customizing context menu
    4. Localizing component
  9. Updating to the latest version
    1. Updating to the latest version
    2. Release notes
    3. Migration guide from 2.6 to 2.7
    4. Migration guide from 2.5 to 2.6
    5. Migration guide from 2.4 to 2.5
    6. Migration guide from 2.3 to 2.4
    7. Migration guide from 2.2 to 2.3
    8. Documentation for older versions
Table of contents

Slice

A slice is a definition of the subset of data from your data source that will be shown in your report when you open it. By using slices in a report you can easily switch between different sets of values. Read more in the following sections:

Slice properties

You can define fields that go to rows, go to columns, go to measures, add filtering, sorting, report filtering, expands, and drills. Here is a list of all available properties for a slice:

  • columns – Array of objects. A list of hierarchies selected in the report slice for columns. Each object can have the following properties:
    • uniqueName – String. The hierarchy’s unique name.
    • caption (optional) – String. The hierarchy’s caption.
    • dimensionName (optional) – String. The dimension name.
    • filter (optional) – Filter Object. Contains filtering information.
    • levelName (optional) – String. Used to specify the level of the hierarchy that is shown on the grid or on the chart.
    • sort (optional) – String. The sorting type for members ("asc", "desc" or "unsorted").
    • sortOrder (optional) – Array of strings. Set custom ordering for hierarchy members. Only for "ocsv", "csv", and "json" data source types. sortOrder can be specified like this: ["member_1", "member_2", etc.].
  • drills (optional) – Object. Contains drill-down information in multi-level hierarchies.
    • drillAll (optional) – Boolean. Indicates whether all levels of all hierarchies in the slice will be drilled down (true) or drilled up (false).
    • columns (optional) – Array of objects. Used to save and restore drilled down columns.
    • rows (optional) – Array of objects. Used to save and restore drilled down rows.
  • drillThrough (optional) – Array of strings. Allows pre-defining the slice for the drill-through view. Only for "ocsv", "csv", and "json" data source types. drillThrough can be specified like this: ["Hierarchy name 1", "Hierarchy name 2", etc.] (see live demo).
  • expands (optional) – Object. Stores information about the expansion of nodes.
    • expandAll (optional) – Boolean. Indicates whether all nodes in the data tree will be expanded (true) or collapsed (false) on the grid and on the charts.
    • columns (optional) – Array of objects. Used to save and restore expanded columns.
    • rows (optional) – Array of objects. Used to save and restore expanded rows.
  • measures – Array of objects. A list of the selected measures and those which have non-default properties. Each object has these properties:
    • uniqueName – String. The measure’s unique name.
    • active (optional) – Boolean. Indicates whether the measure will be selected for the report (true) or not (false). active: false can be useful if the measure has non-default properties, but should not be selected for the grid or the chart.
    • aggregation (optional) — String. The name of the aggregation that will be applied to the measure ("sum", "count", "distinctcount", "average", "median", "product", "min", "max", "percent", "percentofcolumn", "percentofrow", "index", "difference", "%difference", "runningtotals", "stdevp", "stdevs"). If the measure is calculated, aggregation will be set to "none".
    • availableAggregations (optional) — Array of strings. Represents the list of aggregation functions that can be applied to the current measure. If the measure is calculated, availableAggregations will be set to [].
    • caption (optional) – String. The measure’s caption.
    • formula (optional) – String. Represents the formula. Refers to the calculated measure. It can contain the following operators: +, -, *, /. Other measures can be referenced using the measure’s unique name and the associated aggregation function, for example sum("Price") or max("Order"). Flexmonster Pivot supports the following aggregation functions for CSV, OCSV, and JSON data sources: "sum", "count", "distinctcount", "average", "median", "product", "min", "max", "percent", "percentofcolumn", "percentofrow", "index", "difference", "%difference", "runningtotals", "stdevp", "stdevs".
    • individual (optional) – Boolean. Refers to the calculated measure. Defines whether the formula is calculated using raw values (true) or using aggregated values (false). Default value: false.
    • calculateNaN (optional) – Boolean. Refers to the calculated measure. Defines whether the formula is calculated using NaN values (true) or using null values (false). Default value: true.
    • format (optional) – String. The name of the number formatting that will be applied to the measure. Measure values can be formatted according to the number formatting defined in the report. All available number formattings are stored in the formats array in the report. More information about the number formatting part of the report can be found in the number formatting article.
    • grandTotalCaption (optional) – String. The measure’s grand total caption.
  • memberProperties – Array of objects. Each object has the following properties:
    • levelName – String. The hierarchy’s unique name.
    • properties – Array of strings. Represents the properties to be shown on the grid. Other available member properties can be accessed through the context menu.
  • reportFilters – Array of objects. A list of hierarchies selected in the report slice for report filters. Each object has the following properties:
    • uniqueName – String. The hierarchy’s unique name.
    • caption (optional) – String. The hierarchy’s caption.
    • dimensionName (optional) – String. The dimension name.
    • filter (optional) – Filter Object. Contains filtering information.
    • levelName (optional) – String. Used to specify the level of the hierarchy that is shown on the grid or on the chart.
    • sort (optional) – String. The sorting type for members ("asc", "desc" or "unsorted").
    • sortOrder (optional) – Array of strings. Set custom ordering for hierarchy members. Only for "ocsv", "csv", and "json" data source types. sortOrder can be specified like this: ["member_1", "member_2", etc.].
  • rows – Array of objects. A list of hierarchies selected in the report slice for rows. Each object can have the following properties:
    • uniqueName – String. The hierarchy’s unique name.
    • caption (optional) – String. The hierarchy caption.
    • dimensionName (optional) – String. The dimension name.
    • filter (optional) – Filter Object. Contains filtering information.
    • levelName (optional) – String. Used to specify the level of the hierarchy that is shown on the grid or on the chart.
    • sort (optional) – String. The sorting type for members ("asc", "desc" or "unsorted").
    • sortOrder (optional) – Array of strings. Set custom ordering for hierarchy members. Only for "ocsv", "csv", and "json" data source types. sortOrder can be specified like this: ["member_1", "member_2", etc.].
  • sorting (optional) – Object. Defines the sorting for numbers in a specific row and/or column in the pivot table.
    • column – Object. Defines the sorting for numbers in a specific column. This object has 3 properties:
      • tuple – Array of strings. Consists of unique names that identify the column in the table based on the column’s data.
      • measure – Object. Identifies the measure on which sorting will be applied. Has the following properties:
        • uniqueName – String. The measure’s unique name.
        • aggregation (optional) – String. The measure’s aggregation type.
      • type – String. The sorting type ("asc" or "desc").
    • row – Object. Defines the sorting for numbers in a specific row. This object has 3 properties:
      • tuple – Array of strings. Consists of unique names that identify the row in the table based on the row’s data.
      • measure – Object. Identifies the measure on which sorting will be applied. Has the following properties:
        • uniqueName – String. The measure’s unique name.
        • aggregation (optional) – String. The measure’s aggregation type.
      • type – String. The sorting type ("asc" or "desc").

Default slice

If a slice was not defined, Flexmonster will select a default slice for the report, where the first hierarchy from the data goes to rows and the first measure goes to columns. The automatic default slice selection is available for JSON, CSV, and OCSV data sources (it is not available for OLAP). You can turn off the default slice by setting showDefaultSlice in options to false. For example, take a look at the JSON data below:

var jsonData = 
	[
	    {
	        "Category": "Accessories",
	        "Price": 125,
	        "Quantity": 100
	    },
	    {
	        "Category": "Accessories",
	        "Price": 74,
	        "Quantity": 235
	    },
	    {
	        "Category": "Bikes",
	        "Price": 233,
	        "Quantity": 184
	    }
	]

"Category" is the first hierarchy, so it goes to rows. "Price" is the first measure, so it goes to columns. For this dataset, the default slice will look like this:

{
    "dataSource": {
        "data": jsonData
    },
    "slice": {
        "rows": [
            {
                "uniqueName": "Category"
            }
        ],
        "columns": [
            {
                "uniqueName": "[Measures]"
            }
        ],
        "measures": [
            {
                "uniqueName": "Price"
            }
        ]
    }
}

See the same example with a default slice on JSFiddle.

Rows, columns, and measures

Starting from version 2.304, a slice can be defined with only measures:

{
    "dataSource": {
        "filename": "http://www.flexmonster.com/download/data.csv"
    },
    "slice": {
        "measures": [
            {
				"uniqueName": "Price",
				"aggregation": "sum",
				"active": true
            }
        ]
    }
}

Open on JSFiddle.

"uniqueName": "[Measures]" allows you to define where the measures will be displayed (in rows or in columns). By default they go to columns. Here is an example of a slice with rows, columns, and measures:

{
    "dataSource": {
        "filename": "http://www.flexmonster.com/download/data.csv"
    },
    "slice": {
        "rows": [
            {
                "uniqueName": "Category",
                "filter": {
                    "members": [
                        "category.[cars]",
                        "category.[bikes]"
                    ]
                },
                "sort": "desc"
            }
        ],
        "columns": [
            {
                "uniqueName": "[Measures]"
            },
            { 
            	"uniqueName": "Color",
                "filter": {
                    "members": [
                        "color.[blue]"
                    ]
                } 
            }
        ],
        "measures": [
            {
                "uniqueName": "Price",
                "aggregation": "sum",
                "active": true
            },
            {
                "uniqueName": "Discount",
                "aggregation": "min",
                "availableAggregations": ["min", "max"],
                "active": true
            }
        ]
    }
}

See the same example on JSFiddle.

Report filter

A report filter allows you to display different data subsets in the report. In Flexmonster Pivot the reportFilters property is used for defining the report filters as follows:

{
    "dataSource": {
        "filename": "http://www.flexmonster.com/download/data.csv"
    },
    "slice": {
        "reportFilters": [
            {
                "uniqueName": "Color",
                "filter": {
                    "members": [
                        "color.[yellow]",
                        "color.[white]"
                    ]
                }
            }
        ],
        "rows": [
            {
                "uniqueName": "Category"
            }
        ],
        "columns": [
            {
                "uniqueName": "[Measures]"
            }
        ],
        "measures": [
            {
                "uniqueName": "Price"
            }
        ]
    }
}

See an example with a report filter on JSFiddle.

Sorting

The sorting object defines the sorting for numbers in a specific row and/or column in the pivot table. Sorting is usually configured on the grid and then saved within the report. It looks like this:

"sorting": {
    "column": {
        "type": "desc",
        "tuple": [],
        "measure": "Price"
    }
}

Sorting for members of columns and rows is defined like this:

"rows": [
    {
        "uniqueName": "Category",
        "filter": {
            "members": [
                "category.[cars]",
                "category.[bikes]"
            ]
        },
        "sort": "desc"
    }
]

Expands

Information about expands and collapses is stored within the slice. When a customer performs one of these operations, all the changes can be saved within the report. Use the expandAll property to apply the operation to all levels of data detail at once. This is how an expands object looks:

"expands": {
    "expandAll": false,
    "rows": [
        {
            "tuple": [
                "category.[accessories]"
            ]
        },
        {
            "tuple": [
                "category.[cars]"
            ]
        }
    ]
}

Drills

The drills object is used to store information about drill-downs in multi-level hierarchies. Here is an example of a drills object:

"drills": {
    "drillAll": false,
    "rows": [
        {
            "tuple": [
                "category.[accessories]"
            ]
        },
        {
            "tuple": [
                "category.[accessories].[bike racks]"
            ]
        },
        {
            "tuple": [
                "category.[accessories].[bottles and cages]"
            ]
        }
    ]
}

Calculated values

You can create as many calculated measures for one report as you need. When you save the report all the calculated measures will be saved as well and loaded when the report is retrieved. Note that you can add calculated measures only for reports that are based on a JSON, CSV, or OCSV data source. Below is an example of a calculated measure:

"measures": [
    {
        "uniqueName": "Avg",
        "formula": "sum('Price') / count('Category') ",
        "caption": "Avg",
        "active": true
    }
]

Change a slice using the Field List and controls on the grid

Use the Field List to define report filters, rows, columns, and values at run time.

fieldslist

Sorting, filtering, drill-ups, drill-downs, and expand/collapse operations are available directly on the grid and on built-in pivot charts.

Slice via API

You can change the slice along with other report parts using the API call setReport(). To change only the slice use the runQuery() call.