Selecting multiple dates from a date hierarchy?

H

Hans Riis

I have a chart with a date hierarchy on the x-axis. I wrote some
JavaScript code that can select certain dates, i.e. only check the
selected date values in the date measure.

Now I need more functionality that only VBScript seems to provide so
I'm trying to convert my JavaScript to VBScript. There's just one
problem: the "concat" function in JavaScript doesn't exist in VBScript
and I can't concatenate two datearrays with & or +. My code is shown
below:

Set objPFS = ChartSpace1.InternalPivotTable.ActiveView.FieldSets("Date")
Set objPC = ChartSpace1.InternalPivotTable.Constants

objPFS.AllIncludeExclude = objPC.plAllInclude
objPFS.AllIncludeExclude = objPC.plAllExclude

Set objPF = objPFS.Fields("Day")

For i = 0 To 13
date = date() - i
year = cstr(year(dato))
month= monthname(month(dato), False)
day = day(dato)
datearray(i) = Array(objPFS.Member.ChildMembers(year).ChildMembers(month).ChildMembers(day-1))
Next

objPF.IncludedMembers = datearray ' DOESN'T WORK

objPF.IncludedMembers = datearray(0) ' WORKS but only shows one
date

How can I get my datearray with 14 entries into one single array?

Thanks in advance, Hans Riis
 
M

Michael Weiss

Hans,
Try building a string of comma delimited values in your
loop instead of adding them to an array. Then pass this
string like:
objPF.IncludedMembers = Split(mystringofdates, ",")
Hope this helps (actually I just hope it works!lol)
Michael
 
H

Hans Riis

Hi Michael.

Thanks, I tried something like that but I can't get the date value out
of the array. A simple Msgbox(Datearray(0)) shows nothing. I've tried
various datestring formats as the input paramater to IncludedMembers
without any luck. It's seems like the value of a date hierarchy date
isn't just a string...?

Regards, Hans
 
K

Kasper S Nielsen

Thanks, I tried something like that but I can't get the date value out
of the array. A simple Msgbox(Datearray(0)) shows nothing. I've tried
various datestring formats as the input paramater to IncludedMembers
without any luck. It's seems like the value of a date hierarchy date
isn't just a string...?


I'm having the same exact problem - could it really be the case that no
one knows the answer ?

Kasper
 

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