How to create view in TI to specific elements

Post Reply
appleglaze28
Regular Participant
Posts: 269
Joined: Tue Apr 21, 2009 3:43 am
OLAP Product: Cognos TM1, Planning
Version: 9.1 SP3 9.4 MR1 FP1 9.5
Excel Version: 2003

How to create view in TI to specific elements

Post by appleglaze28 »

How do I create a view to limited to specific elements only? I'm creating this as part of a TI that loads that data 3 times a day daily....I need to zero out the certain elements in certain dimensions specifically date, year and measures for that date so I can refresh the data as scheduled. I have other dates for historical purporses so I don't want to miss out on that and so far I ended up creating a view that zero out all my previous data.

Code: Select all

ViewCreate('PRODUCTION_capacity','Current');

ViewTitleDimensionSet('PRODUCTION_capacity','Current','base_month_dates');
ViewTitleDimensionSet('PRODUCTION_capacity','Current','measures_machines_capacity');
ViewTitleDimensionSet('PRODUCTION_capacity','Current','base_years');

ViewTitleElementSet('PRODUCTION_capacity','Current','base_month_dates',DIMIX('base_month_dates',vDate));
ViewTitleElementSet('PRODUCTION_capacity','Current','base_years',DIMIX('base_years',vYear));
ViewTitleElementSet('PRODUCTION_capacity','Current','measures_machines_capacity',DIMIX('measures_machines_capacity','WIP DH Lots'));

ViewZeroOut('PRODUCTION_capacity','Current');

ViewDestroy('PRODUCTION_capacity','Current');
jrizk
Posts: 48
Joined: Thu Nov 19, 2009 10:38 pm
OLAP Product: Tm1
Version: 10.2.2
Excel Version: 2010

Re: How to create view in TI to specific elements

Post by jrizk »

Hi. You don't need to assign the dimension to titles/rows/columns etc in a zero out view. Just assign the elemenst you want to zero out to a subset that is then assigned to the zero our view. If your DIMIX('base_month_dates',vDate) is saved say as the subset CurrentMonths and this contains the elements you want to zero out then assign this to the view as below:

CubeName = 'PRODUCTION_capacity';
ViewName = 'Current' ;
ViewCreate (CubeName, ViewName) ;

DimName = 'base_month_dates';
SubName = 'CurrentMonths';
ViewSubsetAssign(CubeName, ViewName, DimName, SubName);

If you want to hard code specific elements in a dimension then as below:

DimName = 'base_month_dates'';
SubName = ViewName | '_' | DimName;
SubsetCreate (DimName, SubName );
(assuming the view and subset are destroyed each time the process is run)
SubsetElementInsert(DimName, SubName, 'Jan', 1);
SubsetElementInsert(DimName, SubName, 'Feb', 1);
SubsetElementInsert(DimName, SubName, 'Mar', 1);
ViewSubsetAssign(CubeName, ViewName, DimName, SubName);
J.Rizk
Tm1 for everyone
User avatar
Alan Kirk
Site Admin
Posts: 6606
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: How to create view in TI to specific elements

Post by Alan Kirk »

appleglaze28 wrote:How do I create a view to limited to specific elements only? I'm creating this as part of a TI that loads that data 3 times a day daily....I need to zero out the certain elements in certain dimensions specifically date, year and measures for that date so I can refresh the data as scheduled. I have other dates for historical purporses so I don't want to miss out on that and so far I ended up creating a view that zero out all my previous data.

Code: Select all

ViewCreate('PRODUCTION_capacity','Current');

ViewTitleDimensionSet('PRODUCTION_capacity','Current','base_month_dates');
ViewTitleDimensionSet('PRODUCTION_capacity','Current','measures_machines_capacity');
ViewTitleDimensionSet('PRODUCTION_capacity','Current','base_years');

ViewTitleElementSet('PRODUCTION_capacity','Current','base_month_dates',DIMIX('base_month_dates',vDate));
ViewTitleElementSet('PRODUCTION_capacity','Current','base_years',DIMIX('base_years',vYear));
ViewTitleElementSet('PRODUCTION_capacity','Current','measures_machines_capacity',DIMIX('measures_machines_capacity','WIP DH Lots'));

ViewZeroOut('PRODUCTION_capacity','Current');

ViewDestroy('PRODUCTION_capacity','Current');

I should probably reiterate what Lotsa said the last time he replied to you, but what the hey, I'm in need of diversion for a moment...

ViewTitleElementSet is not something that should be used with data movement views. There are no titles, rows and columns in data movement views, those relate to how a human arranges a view for the purposes of slicing and dicing. For data movements, you should look at views as flat files.

To create a view to zero out a range of data you use:
- SubsetCreate to create a subset for any dimensions where you want to limit the elements being zeroed.
- SubsetElementInsert to add those elements to the subset;
- ViewCreate to create the view;
- ViewSubsetAssign to attach the subsets created earlier to the view. All other dimensions will use "All" elements;
- ViewExtractSkipZeroesSet and ViewExtractSkipCalcsSet to skip over zeroes and consolidations.
- ViewZeroOut to zero out the data;
- ViewDestroy to destroy the view after you're finished with it;
- SubsetDestroy to destroy the subsets.
"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.
appleglaze28
Regular Participant
Posts: 269
Joined: Tue Apr 21, 2009 3:43 am
OLAP Product: Cognos TM1, Planning
Version: 9.1 SP3 9.4 MR1 FP1 9.5
Excel Version: 2003

Re: How to create view in TI to specific elements

Post by appleglaze28 »

Okay thanks...I guess ive been so concentrated into reading the cube view and never bothered reading the other stuff...Thanks.
User avatar
jim wood
Site Admin
Posts: 3951
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: How to create view in TI to specific elements

Post by jim wood »

Alan Kirk wrote: To create a view to zero out a range of data you use:
- SubsetCreate to create a subset for any dimensions where you want to limit the elements being zeroed.
- SubsetElementInsert to add those elements to the subset;
- ViewCreate to create the view;
- ViewSubsetAssign to attach the subsets created earlier to the view. All other dimensions will use "All" elements;
- ViewExtractSkipZeroesSet and ViewExtractSkipCalcsSet to skip over zeroes and consolidations.
- ViewZeroOut to zero out the data;
- ViewDestroy to destroy the view after you're finished with it;
- SubsetDestroy to destroy the subsets.
Alan,

Is there command to set skip rule values as well?? I've worked around this in the past,

Jim.
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
User avatar
Alan Kirk
Site Admin
Posts: 6606
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: How to create view in TI to specific elements

Post by Alan Kirk »

jim wood wrote:
Alan Kirk wrote: To create a view to zero out a range of data you use:
- SubsetCreate to create a subset for any dimensions where you want to limit the elements being zeroed.
- SubsetElementInsert to add those elements to the subset;
- ViewCreate to create the view;
- ViewSubsetAssign to attach the subsets created earlier to the view. All other dimensions will use "All" elements;
- ViewExtractSkipZeroesSet and ViewExtractSkipCalcsSet to skip over zeroes and consolidations.
- ViewZeroOut to zero out the data;
- ViewDestroy to destroy the view after you're finished with it;
- SubsetDestroy to destroy the subsets.
Alan,

Is there command to set skip rule values as well?? I've worked around this in the past,

Jim.
You're thinking of ViewExtractSkipRuleValuesSet, I believe.
"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.
User avatar
jim wood
Site Admin
Posts: 3951
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: How to create view in TI to specific elements

Post by jim wood »

Cheers Alan,

That isn't in the help file of the version I have been using for a while. Me being me I just specified a desired subset to work around it,

Jim.
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
Post Reply