工作中遇到的問題,記錄下來方便以后查找。
在saiku中如何設定固定維度?
找到WorkspaceDropZone.js文件,在synchronize_query: function(){}方法中的“var model = this.workspace.query.helper.model();”之前添加如下代碼:
$(self.workspace.dimension_list.el).find('a').each(function(index,item){ if(item.text.indexOf("必選")>=0 || item.text.indexOf("Required")>=0){ if(item.attributes.hasOwnProperty('level') && item.attributes.hasOwnProperty('hierarchy')){ self.workspace.query.helper.includeLevel("ROWS",item.attributes.hierarchy.value,item.attributes.level.value); } } })
這段代碼作用是添加名稱中帶有“必選”兩個字的維度(級別)到queryModel中,所以制作cube的時候固定維度中必須要含有“必選”兩字
其中調用的includeLevel()方法位於SaikuOlapQuery.js文件中,作用是添加level到queryModel
效果圖如下: