IcCube-使用Javascript访问报告代码 [英] IcCube - accessing Report Code with Javascript
问题描述
编辑报告时,可以单击报告代码"以查看有关报告结构的信息.它看起来像这样:
When I am editing a report, I can click on "Report Code" to see information about the report structure. It loks like this:
{
"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访问此信息?上下文.$ report显然没有提供此信息.
How can I access this Information with Javascript? context.$report apparently doesn't give this information.
还有一种获取信息的方法,报表的不同图表中使用了哪些MDX语句?可以使用Javascript更改吗?
Also is there a way to get the information, what MDX statements are used in the different charts of a report? And can this be altered with Javascript?
推荐答案
要获取报告胆量,请将此代码添加到报告代码:
To get report guts add this code to the Report Code:
function consumeEvent( context, event ) {
if (event.name == 'ic3-report-init') {
console.log(event.value.state.report);
}
}
对于在发送之前处理mdx请求,这有点困难.再次在 ReportCode 中:
As for handling mdx request before send, it's kinda harder. Again in 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具有有关该小部件的信息,而请求是请求实例.
In this function item is widgetAdapter with info about the widget and request is request instance.
这篇关于IcCube-使用Javascript访问报告代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!