Hi guys,
I had a brief look in the reference guide and in the forum but I found nothing about it.
Is there a command to check if a view is empty?
check for an empty view
-
- MVP
- Posts: 3706
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: check for an empty view
Some lateral thinking ...
You could assign the view as a data source to a generic process that has skip blanks ON but skip calcs and rules OFF (make sure the process has sufficient variables to accommodate all cubes in the model). On the prolog initialise a counter with a value of zero. On the data tab don't actually use any of the variables but increase the counter, have an IF statement following with a process break if the counter is > 1 (that way if the view is large and contains data the process will still execute quickly). On the epilog test the value of the counter, if it is 1 the view contains data if it is 0 the view contains no data.
Should work.
You could assign the view as a data source to a generic process that has skip blanks ON but skip calcs and rules OFF (make sure the process has sufficient variables to accommodate all cubes in the model). On the prolog initialise a counter with a value of zero. On the data tab don't actually use any of the variables but increase the counter, have an IF statement following with a process break if the counter is > 1 (that way if the view is large and contains data the process will still execute quickly). On the epilog test the value of the counter, if it is 1 the view contains data if it is 0 the view contains no data.
Should work.
-
- Posts: 69
- Joined: Mon Sep 27, 2010 2:46 pm
- OLAP Product: Cognos TM1
- Version: 9.1 onwards
- Excel Version: client dependant
- Location: UK, CH, BE
Re: check for an empty view
well, actually I made it with another workaround,lotsaram wrote:Some lateral thinking ...
You could assign the view as a data source to a generic process that has skip blanks ON but skip calcs and rules OFF (make sure the process has sufficient variables to accommodate all cubes in the model). On the prolog initialise a counter with a value of zero. On the data tab don't actually use any of the variables but increase the counter, have an IF statement following with a process break if the counter is > 1 (that way if the view is large and contains data the process will still execute quickly). On the epilog test the value of the counter, if it is 1 the view contains data if it is 0 the view contains no data.
Should work.
I checked, with a CellGetN, if the value at the Top of all the dimensions is 0 or not.
I was just wondering if there was a command to do this thing in order to use it.
- Steve Vincent
- Site Admin
- Posts: 1054
- Joined: Mon May 12, 2008 8:33 am
- OLAP Product: TM1
- Version: 10.2.2 FP1
- Excel Version: 2010
- Location: UK
Re: check for an empty view
no such command, but be careful using the top level consolidations of all dims to do that. If you use a weighting other than 1 on any elements it could give you a false report...
If this were a dictatorship, it would be a heck of a lot easier, just so long as I'm the dictator.
Production: Planning Analytics 64 bit 2.0.5, Windows 2016 Server. Excel 2016, IE11 for t'internet
Production: Planning Analytics 64 bit 2.0.5, Windows 2016 Server. Excel 2016, IE11 for t'internet
-
- Posts: 69
- Joined: Mon Sep 27, 2010 2:46 pm
- OLAP Product: Cognos TM1
- Version: 9.1 onwards
- Excel Version: client dependant
- Location: UK, CH, BE
Re: check for an empty view
well, I have hard coded there the top level element for some dimensions and some elements passed as parameters for others so I'm pretty sure it is a single cell, I used this, just because the measure i'm considering is a quantity so I can be sure it cannot be a negative value.Steve Vincent wrote:no such command, but be careful using the top level consolidations of all dims to do that. If you use a weighting other than 1 on any elements it could give you a false report...
-
- MVP
- Posts: 3706
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: check for an empty view
That's not quite the same as testing generically whether a view contains data (in fact not even remotely close.) Testing with a CellGetN at the top levels of each dimension in a cube will tell you if there is data in the CUBE as opposed to data in a specific VIEW. You also need to know in advance the dimensions in the cube you are testing and the identity of each element in each dimension that you want to test.stingo wrote:well, actually I made it with another workaround,
I checked, with a CellGetN, if the value at the Top of all the dimensions is 0 or not.
I was just wondering if there was a command to do this thing in order to use it.
If that works in your specific need case then that's fine but it is not the question that you posted.
-
- Posts: 69
- Joined: Mon Sep 27, 2010 2:46 pm
- OLAP Product: Cognos TM1
- Version: 9.1 onwards
- Excel Version: client dependant
- Location: UK, CH, BE
Re: check for an empty view
you are right,lotsaram wrote:That's not quite the same as testing generically whether a view contains data (in fact not even remotely close.) Testing with a CellGetN at the top levels of each dimension in a cube will tell you if there is data in the CUBE as opposed to data in a specific VIEW. You also need to know in advance the dimensions in the cube you are testing and the identity of each element in each dimension that you want to test.stingo wrote:well, actually I made it with another workaround,
I checked, with a CellGetN, if the value at the Top of all the dimensions is 0 or not.
I was just wondering if there was a command to do this thing in order to use it.
If that works in your specific need case then that's fine but it is not the question that you posted.
it works in my proper case but it is absolutely not a generic solution.