Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Page Refresh in Excel Pivottable?
Message
 
À
12/07/2001 11:31:16
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00529753
Message ID:
00530008
Vues:
16
>Let's say I have two comboboxes in the page area of an Excel 2000 pivottable.
>The top combobox named states is the list of 50 states and the lower combobox
>named 'cities' is a list of major cities for each state.
>
>What I'd like to see happen is to only show the cities associated with their state when a specific state is selected. I know that the comboboxes work as filters, but a user has asked if this type of functionality can be made to work inside of a pivottable.

The row and column field labels are dropdowns. This lets your users select which columns or rows to display. In your example, they can filter certain cities or certain states. To do this interactively, the user clicks on the dropdown and then checks those items in the list he’d like to see.

You can accomplish this in code with the PivotField object’s PivotItems collection. Each PivotField has a collection of PivotItems, each correlating to a row or column. The heading labels are used as the index name. One of the 19 properties of the PivotItem object is the Visible property. Setting Visible to .F. removes it from the view. Try something like:
WITH oPivotTable.PivotFields("<i>fieldname</i>")
  .PivotItems("Alaska").Visible = .F.
  .PivotItems("Arizona").Visible = .F.
ENDWITH
Note that you'll have to replace fieldname with the name of your field, as it's shown in the PivotTable (if you used .AddFields() to add the field to the PivotTable, then use either the RowField or the ColumnField name that you passed as a parameter).

Hope this helps.

- della
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform