Page 1 of 1
check for an empty view
Posted: Mon Jan 10, 2011 11:31 am
by stingo
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?
Re: check for an empty view
Posted: Mon Jan 10, 2011 12:24 pm
by lotsaram
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.
Re: check for an empty view
Posted: Mon Jan 10, 2011 1:32 pm
by stingo
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.
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.
Re: check for an empty view
Posted: Mon Jan 10, 2011 3:19 pm
by Steve Vincent
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...
Re: check for an empty view
Posted: Mon Jan 10, 2011 3:25 pm
by stingo
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...
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.
Re: check for an empty view
Posted: Mon Jan 10, 2011 9:18 pm
by lotsaram
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.
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.
If that works in your specific need case then that's fine but it is not the question that you posted.
Re: check for an empty view
Posted: Mon Jan 17, 2011 10:11 am
by stingo
lotsaram wrote: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.
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.
If that works in your specific need case then that's fine but it is not the question that you posted.
you are right,
it works in my proper case but it is absolutely not a generic solution.