Pricing changes are coming in January. Contact our Sales team to secure the current price for your desired license.
All documentation
  • Introduction
  • Connecting to data source
    1. Supported data sources
    2. Connecting to other data sources
  • Browser compatibility
  • Documentation for older versions
  • Setting data types in JSON

    Flexmonster can select field types automatically. For example, check out the data:

    let jsonData = [
    {
    "Country": "Canada",
    "Price": 174,
    }
    ];

    By default, the types of the "Country" and "Price" fields will be set automatically to "string" and "number", respectively.

    You can manually set types for specific fields in one of the following ways:

    Using mapping

    You can use the mapping to define how fields are treated and presented within the component. See how to define the type of a field.

    Using the first object of the JSON array

    To set data types in JSON, you can add the first object with the necessary configurations in a JSON array. Check out the full list of supported properties.

    See an example:

    let jsonData = [
    {
    "Color": {type: "string"},
    "Country": {
    type: "string",
    hierarchy: "Geography"
    },
    "State": {
    type: "string",
    hierarchy: "Geography",
    parent: "Country"
    },
    "City": {
    type: "string",
    hierarchy: "Geography",
    parent: "State"
    },
    "Price": {type: "number"},
    "Quantity": {type: "number"}
    },
    {
    "Color" : "green",
    "Country" : "Canada",
    "State" : "Ontario",
    "City" : "Toronto",
    "Price" : 174,
    "Quantity" : 22
    },
    // Other data
    ];

    const pivot = new Flexmonster({
    container: "pivotContainer",
    componentFolder: "node_modules/flexmonster/",
    toolbar: true,
    report: {
    dataSource: {
    data: jsonData
    },
    // Slice configs
    }
    });

    Live example

    Note If you use a JSON array of arrays, define field types in the first object. In that case, you do not need to specify fields in the first subarray Live example.

    Supported properties

    Check out the list of properties for configuring a field:

    Property/TypeDescription
    type
    String
    The data type. Check out the full list of available data types.
    hierarchy
    String
    optional The hierarchy's name. When configuring hierarchies, specify this property to mark the field as a level of a hierarchy or as a member property of a hierarchy (in this case, the type property should be set to "property").
    See how to configure multilevel hierarchies.
    parent
    String
    optional The unique name of the parent level. This property is necessary if the field is a level of a hierarchy and has a parent level.
    See how to configure multilevel hierarchies.
    isMeasure
    Boolean
    optional Indicates whether a field can be selected only for measures (true) or only for rows, columns, or report filters (false). The isMeasure property works only when the strictDataTypes option is set to true Live example.
    Default value: false.

    Using the date types

    To specify that a field must be interpreted as a date, the field type must be set as one of the following:

    • "date" 
    • "date string"
    • "datetime"
    • "year/month/day"
    • "year/quarter/month/day"

    Note that Flexmonster must support the date format. Read more about input date formats.

    What's next

    You may be interested in the following articles: