Access to the "global" object from JavaSCript used to work few month ago, but it's broken today

Closed
Didier Simon asked 1 day ago

Hi,

The pivot is defined in this way : 

{
    "container": "pivot-container-grid",
    "componentFolder": "/XXX/",
    "global": {
        "dataSource": {
            "type": "Microsoft Analysis Services",
            "localeIdentifier": 1036,
            "proxyUrl": "http://xxx.com:50005",
            "catalog": "XXX",
            "cube": "XXX",
            "roles": "",
            "binary": true
        },
        "options": {
            "grid": {
                "showHeaders": false
            },
            "useOlapFormatting": true,
            "configuratorActive": false
        }
    },
    "toolbar": true,
    "width": "100%",
    "height": "100%",
    "licenseKey": "xxx"
}

NOTE the DataSource is defined at the "global" property, not in the Report (this is the need).

Now using JavaScript I need to define a MDX subQuery on the DataSource.

The code below used to work few months ago (I don't remember when exactly) :

let subQuery = "SELECT [Date].[Date].[All Periods] ON 0, [Measures].MEMBERS ON 1 From [XXX]";

if (subQuery != "") {
    let pivot = document.getElementById("pivot-container-grid").uielement.flexmonster;
    pivot.global.dataSource.subquery = subQuery;
    pivot.refresh();
}

 

The problem is today, using the lasted version (2.9.134) the "global" property at the "pivot" object does not exists anymore.

When how to modify the dataSource specified at the "global" level in this  case ?

Best Regards

Didier

2 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster 12 hours ago

Hi Didier,

Thank you for contacting us.

Flexmonster does not support getting the global object directly from the flexmonster instance. Instead, we recommend using getReport API call with the withGlobals: true option. For example:

function setSubQuery() {

let subQuery =

"SELECT [Date].[Date].[All Periods] ON 0, [Measures].MEMBERS ON 1 From [XXX]";

if (subQuery != '') {

let report = pivot.getReport({ withGlobals: true });

report.dataSource.subquery = subQuery;

pivot.setReport(report);

}

}

You are welcome to check the following example for reference: https://jsfiddle.net/flexmonster/sx8f13a4/.

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Didier Simon 8 hours ago

Thx Nadia,

The solution is fine.

Best Regards

Didier

This question is now closed