What event indicates a filter change?

R

RayTheOtherRay

I have a PivotChart, published to a web page, that uses different
formats (percent, currency, or comma) for the labels beside the
vertical axis depending upon which filter is in use. Right now I am
accomplishing this through the use of form buttons on the html page
that store the appropriate format string as a cookie value and then
reloads the page. On reload, the page picks up the cookie value and
sets the formatting for the vertical axis.

What I would like to do is find an event that is fired when the filter
is changed and let that event check the value of the filter to
determine the proper format string, send it to cookie, and reload the
page. This would keep the user from having to manually choose the
format for themselves.

One of the events I've been looking at from OCWVBA10.CHM is the
DataChange() event. The documentation says that it fires when the
PivotTable changes. It is supposed to return a reason for the change
in the form of a PivotDataReasonEnum. I looked through the constants
for PivotDataReasonEnum and found the following likely candidates that
appeared to have something to do with filtering.

plDataReasonFilterContextChange
plDataReasonFilterFunctionChange
plDataReasonFilterFunctionValueChange
plDataReasonFilterOnChange
plDataReasonFilterOnScopeChange

I believe that if I can find the "reason" that goes with a filter
change, then I can check the value of the filter an determine the
appropriate format string.

Does anyone have any experience with these events and constants, or
events that will do what I'm asking? I'm primarily using JavaScript,
but will gladly look at VBA examples to get the idea of how to do this.

Thanks!
RayTheOtherRay <><
 
A

Alvin Bruney

The event approach in javascript works basically the same as in VBA
however, note the use of the for keyword. For the exact syntax, you can
google this newsgroup. Once you have the event firing and being handled, you
can write a small test application to see if the reason lines up nicely with
the pivot table event.

--

________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
 
R

RayTheOtherRay

It turns out that the event for which I was looking is called
DataSetChange(). This event is fired when the page is first drawn, or
when the Filter values change. Below is the shell for my JavaScript
approach...

<script language='javascript'
for=Uniform_Metrics_31935_Chart
event=DataSetChange()>

....Your code here...

</script>

Hope this helps someone!
RayTheOtherRay <><
 

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