|
发表于 2014-6-28 13:40:40
|
显示全部楼层
shopkins wrote:A dimension can be set to choose 'All <Dimension>' which will pick up all values. How would that fit into the query above? Well, logic would tell you that if you don't want to filter records in the data source based on values in a specific field then you would remove the WHERE clause that is specific to that field. In the case where you want to both allow a WHERE clause and not have a WHERE clause, all based on user selection, then you are not going to be able to use the hard-coded construct of the query. You will have to build your query string on the Prolog tab, using a comination of dimension selections (or TI paramaters), IF statements, and the string functions in TM1. Then you can assign that new query string to the process using the DatasourceQuery local paramter in TI. Something like:
Code: QueryStr = 'SELECT * FROM MyTable':
IF(Dim1@<>'All elements');
QueryStr = QueryStr & ' WHERE Dim1=char(39)&Dim1&char(39);
ELSEIF(Dim2@<>'All elements');
QueryStr = QueryStr & ' WHERE Dim2=char(39)&Dim2&char(39);
.....
ELSEIF(DimX@<>'All elements');
QueryStr = QueryStr & ' WHERE DimX=char(39)&DimX&char(39);
In this case the string 'All elements' would correspond to the node at the top of the house for that dimension. If you further complicate matters by saying you want users to be able to pick ANY node, and have the drill-thru show only children of that node then it gets very tricky. Everyone has their own opinion of how it should work in that case. My preference is to modify the drill thru source to add fields for every level of every drill dimension and place the parent for that level in the field (the parent for level 0 would just be the element itself). Then you can just modify the query to pick values in the parent field and it will work regardless of whether the drill thru selection was a leaf or a node. In either case there is a lot of work to do in the prolog tab because you have to check every dimension variable to find out what level it is in the dimension and then construct the query to look at the correct field in the source. All this, of course, is assuming you have control over the drill thru source and can have someone change it for you if needed. Sometimes this is not the case, depending on your environment. I don't know what you do then. The bottom line is the drill thru setup in TM1 is not childs play and the documentation around it is quite poor. |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|