ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   check if item exist in olap cube (https://www.excelbanter.com/excel-programming/310972-check-if-item-exist-olap-cube.html)

I.Soon

check if item exist in olap cube
 
hi,

I have a pivot table report based on an olap cube, created by the pivot
table wizard. In my report, I have a page field called [date]. I want to
programmically add pageitems for display, based on a date range declared by
the user. This is my code:

activesheet.pivottables(1).pagefields("[Date]").currentpagelist =
Array("[date].[all date].[2002]","[date].[all date].[2003].[January]",
"[date].[all date].[February].[1]")

The problem is, if one of the items declared does not exist in the cube, an
error will be returned. Anyway I can exclude invalid items from the lsit or
to detect whether the items exist or not? By the way, I am unable to use the
PivotItems method to get the page items as it is from an Olap cube.

Thanks

James

check if item exist in olap cube
 
this is what i did...
the simpler way...
when i create the olap cube, i tables to store the dimensions or fact tables.
I first do a database query to find whether the item exist or not before
using the currentpagelist function.
eg. for ur example, just do a select distinct date from the fact table to
find out whether the date exist or not first.

the more complicated way...
do a MDX query to the olap cube using ADOMD
eg.
select [Date].children as column....


rgrds,
James


"I.Soon" wrote:

hi,

I have a pivot table report based on an olap cube, created by the pivot
table wizard. In my report, I have a page field called [date]. I want to
programmically add pageitems for display, based on a date range declared by
the user. This is my code:

activesheet.pivottables(1).pagefields("[Date]").currentpagelist =
Array("[date].[all date].[2002]","[date].[all date].[2003].[January]",
"[date].[all date].[February].[1]")

The problem is, if one of the items declared does not exist in the cube, an
error will be returned. Anyway I can exclude invalid items from the lsit or
to detect whether the items exist or not? By the way, I am unable to use the
PivotItems method to get the page items as it is from an Olap cube.

Thanks



All times are GMT +1. The time now is 04:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com