我有一个多选过滤器小部件,其中包含一个维度的成员,可将其用作我的 mdx 中的过滤器。通过在 mdx 中使用 @{filter) 可以正常工作。好像过滤器是每个用户唯一的,我想将它存储在数据库中并在用户登录时加载它。这工作正常并将过滤器作为 JSON 对象获取:
数据 = [{
“服务号码”:[{
"姓名": "+31880440723",
"uniquename": "[Inkomend 号码].[Inkomend 号码].[Nummer].&[76]&[2308]"
},
{
"姓名": "+31880440747",
"uniquename": "[Inkomend 号码].[Inkomend 号码].[Nummer].&[76]&[2329]"
},
{
"姓名": "+31880440758",
"uniquename": "[Inkomend 号码].[Inkomend 号码].[Nummer].&[76]&[3670]"
},
{
"姓名": "+31880440727",
"uniquename": "[Inkomend 号码].[Inkomend 号码].[Nummer].&[76]&[2312]"
}]
}]
在我的 javascript 代码中,我有一个“fireEvent”事件来实际设置过滤器。代码:
函数消费事件(上下文,事件){
var $report = context.$report;
var fireEvent = context.fireEvent.bind(context);
...
一些代码
...
fireEvent('filter',buildEvent(data));
}
函数构建事件(选择)
{
返回 {
fireMdxByDefault:假,
isGlobalFilter_:真,
类ID:即.event.SetSelectionEvent,
构造函数:函数 w(A,B,z){x.call(this,B,z);this.classID="viz.event.SetSelectionEvent";this.selection=A},
标题:函数 (){if(this.selection&&this.selection.length>0){return ic3.asMdxSet(this.selection,"name",false,true)}else{return""}},
asMdx: function (){if(this.selection&&this.selection.length>0){return ic3.asMdxSet(this.selection,"uniqueName")}else{return null}},
asFilterInitialSelection: function (){if(this.selection&&this.selection.length>0){return ic3.arrayProps(this.selection,"uniqueName")}else{return""}},
getSelectedItems: function (){return this.selection},
isSelectionEvent: function (){return true},
isGlobalFilter: function (){return this.isGlobalFilter_},
isEmptyEvent: function (){return false},
值:函数(){返回this.asMdx()},
asSet: function (){return this.asMdx().replace(/^\(/,"{").replace(/\)$/,"}")},
asDefaultValue: function (){return this.asFilterInitialSelection()},
asReportParam: function (){var H={};H.rpe=1;if(this.isEmptyEvent()){H.nil=true}else{var A=this.caption();if(A!== null){H.dft=A}var D=this.value();if(D!==null){H.val=D}var z=this.asMdx();if(z!==null) {H.mdx=z}var x=this.asFilterInitialSelection();if(x!==null){H.fis=x}if(this.isSelectionEvent()){var B=this.getSelectedItems();if (B!==null){H.sel=B}}}返回 H},
选择:sel.servicenumbers
};
}
如果我在我的 MDX @{filter} 中使用“过滤器”,则过滤器将应用于查询。但是,如果我在我的过滤器小部件中将它用作“设置选择”,它不会应用选择并且没有选择任何内容。
有人对如何使这项工作提出建议吗?