View Construct with Specific measures

Post Reply
ub14
Posts: 25
Joined: Mon Aug 24, 2009 11:13 am
OLAP Product: TM1
Version: 10.2
Excel Version: 2010

View Construct with Specific measures

Post by ub14 »

Hi,

We are trying to create a View with specific Dimension elements and Facts. Fact Dimension is having 3 measures, but we want to create a view with one measure Sales. Below is the Prolog Statement to Create the View, The View is Created Successfullyl but its displaying all the measures. The function ViewTitleElementSet is not considering even if we specify the measure to Sales. Any thoughts on this.

ViewCreate('TestCube','Current1');

ViewRowDimensionSet('TestCube','Current1','Dim1 , 1 );
ViewRowDimensionSet('TestCube','Current1','Dim2' , 1 );
ViewColumnDimensionSet('TestCube','Current1','Fact1' ,1 );

ViewTitleElementSet('TestCube','Current1','Dim1',DIMIX('Dim1', 'All Regions'));
ViewTitleElementSet('TestCube','Current1','Dim2',DIMIX('Dim2', 'All Countries'));
ViewTitleElementSet('TestCube','Current1','M_Expo',DIMIX('M_Expo','Sales'));
Thanks & Regards
vsu
lotsaram
MVP
Posts: 3702
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: View Construct with Specific measures

Post by lotsaram »

Are you trying to create a view for users to browse data or are you trying to create a view to use for data processing? As although both are "views" they are different beasts.

ViewRowDimensionSet, ViewColumnDimensionSet and ViewTitleElementSet are only for USER VIEWS.

For DATA PROCESSING VIEWS you will need
ViewSubsetAssign (and SubsetElementInsert)
ViewExtractSkipCalcsSet
ViewExtractSkipRuleValuesSet
ViewExtractSkipZeroesSet
ub14
Posts: 25
Joined: Mon Aug 24, 2009 11:13 am
OLAP Product: TM1
Version: 10.2
Excel Version: 2010

Re: View Construct with Specific measures

Post by ub14 »

These views are created for users to browse the data. Is there any way we can restrict specific measures for each view.?
Thanks & Regards
vsu
lotsaram
MVP
Posts: 3702
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: View Construct with Specific measures

Post by lotsaram »

ViewTitleElementSet is only, as the name implies, for setting elements in TITLE dimensions, in case you are not familiar with TM1 speak this would be called a "slicer" or "page filter" in Microsoft speak (but in TM1 you can and must only select a single title element, multiple selections are not possible.)

To restrict the members in a row or column dimension of a view you must assign a SUBSET to the view (and members to the subset).
bunchukokoy
Regular Participant
Posts: 197
Joined: Thu Dec 03, 2009 8:47 am
OLAP Product: IBM Cognos TM1
Version: 10.2.2.x
Excel Version: 2010
Location: Singapore

Re: View Construct with Specific measures

Post by bunchukokoy »

Hi Experts.

Just an additional, please correct me if I'm wrong.

For this ViewTitleElementSet to work, the dimension should not use a subset in the view. Logically that's correct, because the subset will defeat the purpose of the function in a way like if the element is not included in the subset.

Is there a workaround or function here? To use a subset and you are sure that the element is included in this subset?

If none, therefore, I'm gonna make available ALL elements in the view even those that are unrelated/ orphans.


Thanks.
Alan Kirk
Site Admin
Posts: 6647
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: View Construct with Specific measures

Post by Alan Kirk »

bunchukokoy wrote: Just an additional, please correct me if I'm wrong.

For this ViewTitleElementSet to work, the dimension should not use a subset in the view. Logically that's correct, because the subset will defeat the purpose of the function in a way like if the element is not included in the subset.

Is there a workaround or function here? To use a subset and you are sure that the element is included in this subset?

If none, therefore, I'm gonna make available ALL elements in the view even those that are unrelated/ orphans.
That's fortunate, since that's what you have to do anyway.

Look at the arguments to the function:
ViewTitleElementSet
This is a TM1® TurboIntegrator function, valid only in TurboIntegrator processes.

This function sets a title element for a TM1 view. ViewTitleElementSet is used in conjunction with the ViewTitleDimensionSet function.
Syntax
ViewTitleElementSet(CubeName, ViewName, DimName, Index);
Argument Description
CubeName The parent cube of the view for which you are setting the title element.
ViewName The view for which you are setting the title element.
DimName The parent dimension of the title element.
Index An index into the specified dimension that indicates the element to be set as the title element.
Emphasis on the last argument added. The index is the dimension index, not a subset index, ergo based on all of the elements of the dimension.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
lotsaram
MVP
Posts: 3702
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: View Construct with Specific measures

Post by lotsaram »

That's not my experience with how title dimensions in views behave. If a subset is assigned and say the selected element saved with the view is the 2nd element in the subset and that element is deleted from the subset then the view will then show what was the 3rd element in the subset but is now the 2nd element. This would suggest that the index property saved with the view does actually apply to subset index. Mind you I am talking here of views created manually and not with ViewConstruct but I assume the same would apply.
Alan Kirk
Site Admin
Posts: 6647
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: View Construct with Specific measures

Post by Alan Kirk »

lotsaram wrote:That's not my experience with how title dimensions in views behave.
On the contrary; I'd suggest that this is exactly your experience if you look at it a little differently because...
lotsaram wrote:If a subset is assigned
... that is the key point. There is no argument in the function which allows you to pass a subset name. Consequently if you want to look at it more pedantically you could say that the function allows you to specify the index of only one subset, that being the implicit "All" subset of the dimension. For practical purposes this is exactly the same as saying that it's "An index into the specified dimension" as the help file does, but if you look at it in those terms it explains the behaviour that you describe below.
lotsaram wrote:and say the selected element saved with the view is the 2nd element in the subset and that element is deleted from the subset then the view will then show what was the 3rd element in the subset but is now the 2nd elent.
Exactly. Which would be the case with the implicit ALL subset if the second element was deleted from the dimension.
lotsaram wrote:This would suggest that the index property saved with the view does actually apply to subset index. Mind you I am talking here of views created manually and not with ViewConstruct but I assume the same would apply.
Au contraire... there is one big difference between GUI created views and views created with this function, and that is that a GUI created view allows you three options:
(a) Specifying a named subset from which to draw a title element;
(b) Specifying an unnamed subset from which to draw an element, in which case all of the element names are written to the .vue file; or
(c) Not specifying a subset at all, although it appears to me from an examination of a few .vue files in 9.5.2 that this will result in the existing members of the subset (the "All" subset at the time of creation) being listed in the .vue as if it was an unnamed subset. (Views created through the Export As Text Data dialog are different; they will specify the ALL subset as the source in the .vue file. Edit: So will views which are created using these TI functions, unless an additional function is also used. See the following edit.)

As mentioned above the TI function does not allow you to pass a subset name, which rules out option A. (Edit: Unless you use another function as well to assign the subset. You can't do it from this function alone. Again, see the following edit.) Option B would only be possible if TI allowed arrays. (Or other common data and flow structures that have been in other languages since Bill Gates was writing code on the walls of caves in southern France back in the Neolithic period.) Kludgy workarounds are not counted here, nor could they be used with the arguments of a TI function anyway. The API functions for creating a view can handle arrays for assigning unnamed subsets, but the TI function can't.

I'd suggest, without malice in this case, that the ViewTitleElementSet function was just an exercise in box ticking. It provides a subset (no pun intended) of the functionality that you have in the GUI. It could have been expanded to handle named subsets (but not unnamed ones until or unless TI learns to deal with arrays), but that was enough for the purposes of the exercise (the exercise being for Applix (at the time) to be able to say "well, the function is there!") since hardly anyone is likely to use the thing anyway.

Subsequent Edit

Out of curiosity I just ran up a TI to create a view using these functions.

As I thought, if you use the ViewTitleDimensionSet and ViewTitleElementSet functions alone your titles will be defined on the implicit ALL subset and the .vue file will reflect that fact.

However Applix did a little more than they appeared to, which makes the documentation misleading. This is, no doubt, a surprise to all.

If you want to create a view with an unnamed subset in the title you are still Sierra Oscar Lima, as I said.

However you can in fact have a named subset in the title by using ViewSubsetAssign in addition to the functions mentioned above. If you do so after calling the ViewTitleElementSet, the index that you specified in the latter function is used for the subset rather than the dimension. (If the index is invalid it just reverts to 1.)

I think this is one for the Documentation Deficiencies thread as well.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
bunchukokoy
Regular Participant
Posts: 197
Joined: Thu Dec 03, 2009 8:47 am
OLAP Product: IBM Cognos TM1
Version: 10.2.2.x
Excel Version: 2010
Location: Singapore

Re: View Construct with Specific measures

Post by bunchukokoy »

Thanks to all for sharing the knowledge and for spending time discovering more of this function. :)
Post Reply