IcCube-使用Javascript访问报表代码



编辑报表时,可以单击"报表代码"查看有关报表结构的信息。它是这样的:

{
"classID": "ic3.ReportGuts",
"guts_": {
    "ic3Version": 12,
    "schemaName": "test_schema",
    "cubeName": "Cube",
    "layout": {
        "classID": "ic3.FixedLayout",
        "guts_": {
            "ic3Version": 12,
            "grid": 10,
            "boxes": [
                {
                    "classID": "ic3.FixedLayoutBox",
                    "guts_": {
                        "ic3Version":...

如何使用Javascript访问此信息?上下文$报告显然并没有提供这些信息。

还有没有一种方法可以获得信息,在报告的不同图表中使用了哪些MDX语句?这可以用Javascript改变吗?

要获得报告内脏,请将此代码添加到报告代码

function consumeEvent( context, event ) {                                
  if (event.name == 'ic3-report-init') {                                 
    console.log(event.value.state.report);
  }                                                                      
}

至于在发送之前处理mdx请求,这有点困难。再次出现在ReportCode中:

function consumeEvent( context, event ) {                                
   if (event.name == 'ic3-report-init') {       
    event.value.widgetMgr().forEach(function(idx,item){
        if(item.hasOwnProperty('onVizBeforeRequestSend')){
            return;
        }
        var oldMethod = item.onVizBeforeRequestSend.bind(item);
        item.onVizBeforeRequestSend = function(request){
            console.log(item, request);
            oldMethod(request);
        }
    });
}

在这个功能项中是widgetAdapter,其中包含关于小部件的信息,请求是请求实例。

最新更新