如何根据TOP(x)样式查询使用静态范围并显示成员 [英] How to use a static range and display members according a TOP(x) style query

查看:86
本文介绍了如何根据TOP(x)样式查询使用静态范围并显示成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试添加一个滑块jquery小部件,并希望定义一个静态范围,例如百分比从0%到100%. 然后,我们希望使用该范围内滑块中的值作为TOP(x)的参数,如图所示.

We are trying to add a slider jquery widget, and would like to define a static range, say percentage from 0% to 100%. Then we would like to use the value from the slider in that range as the parameter for the TOP(x), as shown on the picture.

这可能吗? 有什么提示吗?

Is this possible? Any hints ?

推荐答案

我已经为您创建了一个示例报告,并使用默认的[Sales]模式将其导入 https://drive.google.com/file/d/0B3kSph_LgXizdk9OdnlTWkxHa1U/view ?usp =分享

I've created an example report for you, import it using the default [Sales] schema https://drive.google.com/file/d/0B3kSph_LgXizdk9OdnlTWkxHa1U/view?usp=sharing

您可以通过使用下一个序列来实现此功能:

You could achieve this functionality by using the next sequence:

  1. 创建滑块小部件
  2. 打开窗口小部件选项对话框并配置窗口小部件属性
  3. 选择查询向导->查询类型:Mdx层次结构
  4. 添加单个随机层次结构以绕过验证(它将被替换)
  5. 设置初始选择"中的默认值(即10%)
  6. 向您的报告javascript添加代码

viz.filters.Slider.prototype.componentWillMount = function(){
    if(_.isArray(this.props.items)) 
        this.setState({
          entities:new viz.EntityData(this.props.items),
          range:_.map(this.props.defaults,"uniqueName")
        });
}

viz.filters.Slider.prototype.onBuildAllDone = function(){
    if(!_.isEmpty(this.state.range)) {
        this.fireEvent(vizEventType.onSelection,
                       this.createEvent(this.state.range));
        this.fireEvent(vizEventType.onNewLabel,
                       this.createEvent(this.state.range));
    }
} 

function consumeEvent( context, event ) {                                
  if (event.name == 'ic3-report-init') { 
    // Following code will replace a data provider for Slider
    // with generated numbers. But to do so, you'll need UID of
    // the Slider widget, in this example it's "w1"
    var widget = event.value.widgetMgr().getItemById("w1");
    _.assign(widget.builder().guts_, {
      items:_.times(100, function(idx){
        return {
          name:idx + 1 + "%", 
          uniqueName:idx + 1
        }
      })})                                          
  }                                                                      
}

这篇关于如何根据TOP(x)样式查询使用静态范围并显示成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆