Thao, Date hierarchy still doesn't work. Please help.

H

Hans Riis

Hi Thao.

Thanks for looking at my problem in a previous posting. It's getting very
critical now as my boss
and my client are fighting over what is reasonable to provide besides the
standard functionality.

I get the right values for year/month/day when running

SetLocale("en-us")

For i = 0 To 13
datevar = date()-i
yearvar = cstr(year(datevar))
monthvar = monthname(month(datevar), False)
dayvar = day(datevar)
MSGBOX(yearvar & " " & monthvar & " " & dayvar)
datearray(i) =
objPFS.Member.ChildMembers(yearvar).ChildMembers(monthvar).ChildMembers(dayv
ar-1).value
MSGBOX(datearray(i))
Next

The result of the first Msgbox is 2004 October 16 - 2004 October 29. The
second Msgbox yields only the numbers 16-29.

If I don't write ".value" at the end when extracting dates from the
objPFS.Member, I get an error.

Both our SQL Server and Analysis Manager are English versions so the
SetLocale should ensure the correct date values.

To me it seems like the problem lies in one of these lines:

datearray(i) =
objPFS.Member.ChildMembers(yearvar).ChildMembers(monthvar).ChildMembers(dayv
ar-1).value
objPF.IncludedMembers = datearray

Thao would you please please please help me solve this problem before I get
caught between my boos and my client?

Thanks again, Hans Riis
 
H

Hans Riis

O Great Thao, where art thou?

I still can't solve my date problem.

I feed my datearray with values from the objPFS object.
I'm sure that my yearvar, monthvar and dayvar variables are correct but
still the includedmembers aren't correct.
They show the right day of month but in the wrong months. I can't find any
logic in which months are chosen for the respective days.
F.ex. I might get the last 5 days of May and the first 9 days of October.

Why does the ActiveX component react so differently in VBScript when it does
the right thing in JavaScript?

Below is a snippet of JavaScript that works:

for(i=13;i>=0;i--) {
var datevar = new Date();
datevar.setDate(datevar.getDate() - i );
var dayvar = datevar.getDate();
var monthNumber = datevar.getMonth();
var monthvar = monthToMonthString(monthNumber + 1);
var yearvar = "" + datevar.getFullYear();

datearray =
datearray.concat(Array(objPFS.Member.ChildMembers(yearvar).ChildMembers(monthvar).ChildMembers(dayvar
- 1)));
}
objPF.IncludedMembers = datearray;

I hope you (or someone else) can help me out.

Thanks in advance, Hans Riis
 
M

Michael Vardinghus

Why not solve it on the server using SQL in a time-dimension table ?

/Michael V.
 
H

Hans Riis

Hi Michael.

Thanks for replying.

I'm not sure I understand what you mean but I'm open to all suggestions
if you have the time to elaborate.

The only requirement is that the date hierarchy is controlled client-side,
i.e. if the user selects a certain time period, the rest of the dates must
still be available for selection.

Currently I'm "cheating" by calling a JavaScript function from VBScript.
However, VBScript has one major advantage over JavaScript as VBScript
will accept a date that doesn't exist whereas JavaScript gives a "Subscript
out of range" error.
I try to make sure that there are no gaps in my date hierarchy but it's more
reassuring to know that the script won't fail in case a date is missing (I'm
running
about 20 different cubes now and by the time I'm done with the project, the
number will be near 50).

Michael, Thao, Wei-Dong XU, anyone. Can you please help?

Thanks, Hans Riis


Michael Vardinghus said:
Why not solve it on the server using SQL in a time-dimension table ?

/Michael V.
O Great Thao, where art thou?

I still can't solve my date problem.

I feed my datearray with values from the objPFS object.
I'm sure that my yearvar, monthvar and dayvar variables are correct but
still the includedmembers aren't correct.
They show the right day of month but in the wrong months. I can't find any
logic in which months are chosen for the respective days.
F.ex. I might get the last 5 days of May and the first 9 days of October.

Why does the ActiveX component react so differently in VBScript when it
does
the right thing in JavaScript?

Below is a snippet of JavaScript that works:

for(i=13;i>=0;i--) {
var datevar = new Date();
datevar.setDate(datevar.getDate() - i );
var dayvar = datevar.getDate();
var monthNumber = datevar.getMonth();
var monthvar = monthToMonthString(monthNumber + 1);
var yearvar = "" + datevar.getFullYear();

datearray =

datearray.concat(Array(objPFS.Member.ChildMembers(yearvar).ChildMembers(monthvar).ChildMembers(dayvar-1)));
}
objPF.IncludedMembers = datearray;

I hope you (or someone else) can help me out.

Thanks in advance, Hans Riis


Hi Thao.

Thanks for looking at my problem in a previous posting. It's getting very
critical now as my boss and my client are fighting over what is reasonable
to provide besides the standard functionality.

I get the right values for year/month/day when running

SetLocale("en-us")

For i = 0 To 13
datevar = date()-i
yearvar = cstr(year(datevar))
monthvar = monthname(month(datevar), False)
dayvar = day(datevar)
MSGBOX(yearvar & " " & monthvar & " " & dayvar)
datearray(i)
=objPFS.Member.ChildMembers(yearvar).ChildMembers(monthvar).ChildMembers(dayvar-1).value
MSGBOX(datearray(i))
Next

The result of the first Msgbox is 2004 October 16 - 2004 October 29.
The second Msgbox yields only the numbers 16-29.

If I don't write ".value" at the end when extracting dates from the
objPFS.Member, I get an error.

Both our SQL Server and Analysis Manager are English versions so the
SetLocale should ensure the correct date values.

To me it seems like the problem lies in one of these lines:

datearray(i) =
objPFS.Member.ChildMembers(yearvar).ChildMembers(monthvar).ChildMembers(dayvar-1).value

objPF.IncludedMembers = datearray

Thao would you please please please help me solve this problem before I get
caught between my boos and my client?

Thanks again, Hans Riis


I ran your date parsing code only and it does print the correct date for me.
You might want to verify your parsed date data are mapped to the correct
objPFS.Members. And also check your date format. This should not be
an issue but you should verify anyway. I am using US date format
(mm/dd/yyyy.)

----------------------------------------------------------------------
Thao Moua
OWC Chartspace Support

This posting is provided "AS IS" with no warranties, and
confers no rights. Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
----------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top