Need a special offer?Find out if your project fits.
+
All documentation
  • API Reference for older versions
  • getMembers

    getMembers(uniqueName: String, memberName: String, callbackHandler: Function): Object[]

    Returns a list of members for the specified field. Note that getMembers has an async equivalent — getMembersAsync.

    Parameters

    Parameter/TypeDescription
    uniqueName
    String
    The field’s unique name.
    memberName
    String
    optional The field member's name. This property is used for the multilevel hierarchies. Specify the memberName to get children of the specified member. Learn more in the Usage section.
    Only for the "api", "elasticsearch", and "microsoft analysis services" data sources types.
    callbackHandler
    Function
    optional A JS function that is called when a list of members is loaded. The following data is passed to the callbackHandler:The callbackHandler is needed when working with server-side data sources since they do not provide all the data at once but on demand.
    If the required field members are already loaded to the component (e.g., when the field is selected in the slice), the callbackHandler will return the result instantly.
    Only for the "api", "elasticsearch", and "microsoft analysis services" data sources.

    Usage

    JSON and CSV data sources

    When using the "json" or "csv" data source type, only the uniqueName parameter is needed. Other parameters will be ignored.

    If the field is a multilevel hierarchy, getMembers() returns a tree where each field member has a full list of its children.

    Other data source types

    When using the "api", "elasticsearch", or "microsoft analysis services" data source type, call getMembers() with the uniqueName, memberName, and callbackHandler parameters.

    If the field is not a multilevel hierarchy, set the memberName to an empty string.

    If the field is a multilevel hierarchy, setting the memberName to an empty string returns members of the first hierarchy level. If you want to get the children of a specific member, specify its name in the memberName. Check out an example.

    Returns

    An array of ResultMemberObjects that describe the field members.

    For server-side data sources, if data loading is in progress and the callbackHandler is not specified, an empty array will be returned.

    ResultMemberObject

    This object describes a member of a field. It has the following properties:

    Property/TypeDescription
    uniqueName
    String
    The member's unique name.
    caption
    String
    The member's caption.
    dimensionName
    String
    The name of the dimension to which the field member belongs.
    hierarchyName
    String
    The unique name of the field to which the member belongs.
    hierarchyCaption
    String
    The field’s caption.
    parentMember
    String
    The name of the member’s parent in the hierarchy.
    isLeaf
    Boolean
    Indicates whether the member is a leaf node (true) or not (false).
    children
    ResultMemberObject[]
    Сhildren of the current member. If there are no children (isLeaf: true), the children property is equal to [].
    Only for "json" and "csv" data sources.

    Examples

    1) CSV data source, where the Category field has only one level:

    flexmonster.getMembers("Category"); 

    /* method returns an array of ResultMemberObjects
    [
    {
    "uniqueName": "category.[accessories]",
    "caption": "Accessories",
    "dimensionName": "Category",
    "hierarchyName": "Category",
    "hierarchyCaption": "Category",
    "parentMember": "category.[(all member)]",
    "isLeaf": true,
    "children": []
    },
    {
    "uniqueName": "category.[bikes]",
    "caption": "Bikes",
    "dimensionName": "Category",
    "hierarchyName": "Category",
    "hierarchyCaption": "Category",
    "parentMember": "category.[(all member)]",
    "isLeaf": true,
    "children": []
    },
    // ...
    ]
    */

    Live example

    2) CSV data source, where the Geography field has more than one level:

    flexmonster.getMembers('Geography'); 

    /* method returns an array of objects
    [
    {
    "uniqueName": "geography.[midwest]",
    "caption": "Midwest",
    "dimensionName": "Geography",
    "hierarchyName": "Geography",
    "hierarchyCaption": "Geography",
    "parentMember": "geography.[(all member)]",
    "isLeaf": false,
    "children": [
    {
    "uniqueName": "geography.[midwest].[illinois]",
    "caption": "Illinois",
    "dimensionName": "Geography",
    "hierarchyName": "Geography",
    "hierarchyCaption": "Geography",
    "parentMember": "geography.[midwest]",
    "isLeaf": false,
    "children": [
    {
    "uniqueName": "geography.[midwest].[illinois].[chicago]",
    "caption": "Chicago",
    "dimensionName": "Geography",
    "hierarchyName": "Geography",
    "hierarchyCaption": "Geography",
    "parentMember": "geography.[midwest].[illinois]",
    "isLeaf": true,
    "children": []
    },
    {
    "uniqueName": "geography.[midwest].[illinois].[springfield]",
    "caption": "Springfield",
    "dimensionName": "Geography",
    "hierarchyName": "Geography",
    "hierarchyCaption": "Geography",
    "parentMember": "geography.[midwest].[illinois]",
    "isLeaf": true,
    "children": []
    }
    ]
    },
    // ...
    ]
    },
    // ...
    ]
    */

    Live example

    3) OLAP data source, where the [Product].[Product Categories] hierarchy has more than one level:

    flexmonster.getMembers('[Product].[Product Categories]', '', onGetMembers); 

    function onGetMembers(members) {
      for (var i = 0; i < members.length; i++) {
       console.log(members[i]);
      }
    }

    /* the output will be the following:
    [
    {
    caption: "Accessories",
    dimensionName: "[Product]",
    hierarchyCaption: "Product Categories",
    hierarchyName: "[Product].[Product Categories]",
    isLeaf: false,
    parentMember: "[Product].[Product Categories].[All Products]",
    uniqueName: "[Product].[Product Categories].[Category].&[4]"
    }
    {
    caption: "Bikes",
    dimensionName: "[Product]",
    hierarchyCaption: "Product Categories",
    hierarchyName: "[Product].[Product Categories]",
    isLeaf: false,
    parentMember: "[Product].[Product Categories].[All Products]",
    uniqueName: "[Product].[Product Categories].[Category].&[1]"
    }
    {
    caption: "Clothing",
    dimensionName: "[Product]",
    hierarchyCaption: "Product Categories",
    hierarchyName: "[Product].[Product Categories]",
    isLeaf: false,
    parentMember: "[Product].[Product Categories].[All Products]",
    uniqueName: "[Product].[Product Categories].[Category].&[3]"
    }
    {
    caption: "Components",
    dimensionName: "[Product]",
    hierarchyCaption: "Product Categories",
    hierarchyName: "[Product].[Product Categories]",
    isLeaf: false,
    parentMember: "[Product].[Product Categories].[All Products]",
    uniqueName: "[Product].[Product Categories].[Category].&[2]"
    }
    ]
    */

    Live example

    See also

    getMembersAsync